Java Runtime.getRuntime()
Syntax
Runtime.getRuntime() has the following syntax.
public static Runtime getRuntime()
Example
In the following code shows how to use Runtime.getRuntime() method.
//from w ww. j av a 2 s.c om
public class Main {
public static void main(String[] args) {
// get the current runtime assosiated with this process
Runtime run = Runtime.getRuntime();
// print the current free memory for this runtime
System.out.println("" + run.freeMemory());
}
}
The code above generates the following result.