Name

java.lang.Runtime

Synopsis

This class is a stripped-down version of the J2SE Runtime class. Aside from the static getRuntime() method, which ensures a single Runtime object for the system, this class consists of only four methods to encapsulate platform-dependent system functions: two for monitoring total and currently used memory, one for garbage collection, and one to exit the program.

public classRuntime {
   // static methods
   public static Runtime getRuntime();

   // public instance methods
   public void exit(int status);
   public native long freeMemory();
   public native void gc();
   public native long totalMemory();
}

Get Wireless Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.