Java.lang Package Classes

Java.lang.Runtime Class



Java Runtime Class

Java.lang package provides a Runtime class and Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running.

Class declaration

The declaration of java.lang.Runtime class is:

public class Runtime
  extends Object

java.lang.Runtime Methods

The java.lang.Runtime class has a number of methods which are listed below:

Member Methods

S.NMethods & 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 following class:

  • java.lang.Object