Java Reference
In-Depth Information
Summary
Java's standard class library provides various language-oriented APIs via the
java.lang and java.math packages. These APIs include Math and
StrictMath , Package , Primitive Type Wrapper Class, Reference, Reflection,
String , StringBuffer and StringBuilder , System , Threading,
BigDecimal , and BigInteger .
The Math and StrictMath classes offer a wide variety of useful math-oriented
methods for calculating trigonometric values, generating pseudorandom numbers, and
soon. StrictMath differsfrom Math byensuringthatallofthesemathematicalop-
erations yield the same results on all platforms.
The Package class provides access to package information. This information in-
cludesversiondetailsabouttheimplementationandspecificationofaJavapackage,the
package's name, and an indication of whether the package is sealed or not.
Instances of the Boolean , Byte , Character , Double , Float , Integer ,
Long , and Short primitive type wrapper classes wrap themselves around values of
primitive types. These classes are useful for storing primitive values in collections,
and for providing a good place to associate useful constants (such as MAX_VALUE
and MIN_VALUE )andclassmethods(suchas Integer 's parseInt() methodsand
Character 's isDigit() , isLetter() , and toUpperCase() methods) with
the primitive types.
The Reference API makes it possible for an application to interact with the garbage
collector in limited ways. This API consists of classes Reference , Referen-
ceQueue , SoftReference , WeakReference , and PhantomReference .
SoftReference is useful for implementing image caches, WeakReference is
usefulforpreventingmemoryleaksrelatedtohashmaps,and PhantomReference is
usefulforlearningwhenanobjecthasbeenfinalizedsothatitsresourcescanbecleaned
up.
TheReflectionAPIletsapplicationslearnaboutloadedclasses,interfaces,enums(a
kind of class), and annotation types (a kind of interface). It also lets applications load
classes dynamically, instantiate them, find a class's fields and methods, access fields,
call methods, and perform other tasks reflectively.
TheentrypointintotheReflectionAPIisaspecialclassnamed Class .Additional
classes include Constructor , Field , Method , AccessibleObject , and Ar-
ray .
Search WWH ::




Custom Search