What is the purpose of the Runtime class?

What is the purpose of the Runtime class?

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.

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.
What is the difference between a static and a non-static inner class?
Static and a non-static inner class - Like static methods and static members are defined in a class, a class can also be static...
Difference between the String and StringBuffer classes
Difference between the String and StringBuffer classes - String class is immutable. The characters of string objects can not be changed / modified...
What is the Dictionary class?
What is the Dictionary class? - The Dictionary class is an abstract class. The class maps keys to values...
Post your comment