Java.lang.Runtime Class

Java Runtime Class

The Runtime class is part of the Java.lang package , i.e Java.lang.Runtime, and every Java programme has a single instance of it. It allows the application to interact with the environment in which it is operating.

Class declaration

The declaration of java.lang.Runtime class is:


public class Runtime 
 extends Object

Java.lang.Runtime Methods

This class has a number of methods which are listed below:


Member Methods


S.N Methods & Description
1. long freeMemory()
Returns the amount of free memory in the Java Virtual Machine.
2. long maxMemory()
Returns the maximum amount of memory that the Java virtual machine will attempt to use.
3. long totalMemory()
Returns the total amount of memory in the Java virtual machine.

Methods inherited

This class inherits the methods of the following class:

  • java.lang.Object


To open the online compiler click here.


Also Read: Java – Break Statement

Leave a Reply

Your email address will not be published. Required fields are marked *