top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the purpose of the Runtime class in Java?

0 votes
730 views
What is the purpose of the Runtime class in Java?
posted Aug 9, 2017 by Riya Kumari

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
run time classes used to interact with JRE and there is only one instance of runtime class for one java application. it invokes processes and GC.

1 Answer

+1 vote

The java runtime system can be accessed by the Runtime class.

The runtime information – memory availability, invoking the garbage collector is possible by using Runtime class.

Knowing the free memory space:
Runtime.freeMemory() - Returns the free memory of
Runtime.maxMemory() - Returns the memory that JVM can use at the maximum.

Invoking garbage collector:
Runtime.gc();

Some other facilities that are provided by Runtime class are:
- Reading data through key board
- Using system properties and environment variables
- Running non-java programs from within a java application.

answer Aug 14, 2017 by Mantosh Dubey
...