Java Reference
In-Depth Information
Table 4-1. The java.lang Package (Continued)
J2SE SDK 1.4.2
CLDC 1.0
CLDC 1.1
String
Different
Different
StringBuffer
Different
Different
System
Different
Same as CLDC 1.0
Thread
Different
Different
ThreadGroup
-
-
ThreadLocal
-
-
Throwable
Different
Same as CLDC 1.0
Void
-
-
Table 4-2. The java.lang.ref Package
J2SE SDK 1.4.2
CLDC 1.0
CLDC 1.1
Classes
PhantomReference
-
-
Reference
-
Different
ReferenceQueue
-
-
SoftReference
-
-
WeakReference
-
Different
java.lang.Object , as always, is the root of every Java class. It remains mostly unchanged
from J2SE, but there are some important differences. These differences are detailed in the
upcoming text.
No Object Finalization
Object finalization is not available in CLDC (and, by extension, MIDP). Finalization is a mech-
anism by which objects can clean up after themselves just before they are garbage collected. In
J2SE, an Object 's finalize() method is called before the object is reclaimed by the garbage
collector. No such mechanism exists in CLDC. If you need to clean up resources, you will need
to do it explicitly instead of placing cleanup code in finalize() . This is a good idea anyhow,
particularly in a small device with limited resources. Explicitly cleaning up resources means
that the memory and processing power they consume will be reclaimed sooner rather than
later. Cleanup code in finalize() methods doesn't get executed until the garbage collector
runs, and you never know exactly when that's going to happen.
 
Search WWH ::




Custom Search