Name

Package java.lang

Synopsis

The java.lang package, whose class hierarchy is shown in Figure 12-1, contains the classes that form the core of the Java language API. The CLDC version of this package contains just under half of the classes and interfaces of its J2SE counterpart. The major omissions are:

  • Most of the Error classes, which are not required because the CLDC VM does not support them. Some of the J2SE Exception classes are also omitted.

  • The Float and Double types, omitted because the VM does not provide floating point operations.

  • Various other classes such as ClassLoader, SecurityManager and StrictMath which are not needed because the associated functionality is not part of the CLDC specification.

The most fundamental classes in this package are Object, Class and Throwable.

Object is the base class for all Java objects. The CLDC Object class provides most of the methods of its J2SE counterpart, with the notable exceptions of clone() and finalize(), which are omitted because neither cloning nor finalization is supported in the CLDC Java virtual machine.

Class contains the information used to manage a class in the Java virtual machine. The CLDC version of this class does not contain the methods from the J2SE version that are related to reflection, again because reflection is not provided by the CLDC virtual machine.

Throwable is the base class for all Java exceptions. Throwable has two subclasses, Exception and Error, that are the roots of separate class hierarchies ...

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.