Name

System

Synopsis

The System class contains static methods and variables that provide access to low-level facilities. The CLDC version of this class contains only a small subset of the functionality of its J2SE counterpart.

The public static variables out and err are PrintStream objects that can be used for standard output and error output. With J2ME, these streams are useful when running code in an emulated environment, where they typically result in the creation of log files. Note that there is no in variable as there is no standard input stream for a CLDC device.

The currentTimeMillis() method returns the current time as a millisecond offset from 0:00 UTC on January 1st, 1970. This is the same representation used by the java.util.Date and java.util.Calendar classes.

The exit() method causes the virtual machine to terminate. A CLDC application is permitted to invoke this method. However, a MIDlet will receive a SecurityException if it attempts to do so. The gc() method hints to the garbage collector that it should attempt to reclaim unreferenced memory. Note that the garbage collectors implemented in the small-footprint virtual machines (such as the KVM) are aggressive at cleaning up unused memory, so this method should not need to called very often.

The identityHashCode() method returns a system-defined hash code for the object passed as its argument. This method returns the same value as the hashCode() method in the Object class would for the same object. It is provided ...

Get J2ME in a Nutshell 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.