16 Exploring java.lang
16 Exploring java.lang
T
his chapter discusses thos e classes and interfaces defined byjava.lang. As you know,
java.langis automatically imported into all programs. It contains classes and interfaces
that are fundamental to virtually all of Java programming. It is Java’s most widely
used package.
java.langincludes the following classes:
Boolean InheritableThreadLocal Runtime System
Byte Integer RuntimePermission Thread
Character Long SecurityManager ThreadGroup
Class Math Short ThreadLocal
ClassLoader Number StackTraceElement Throwable
Compiler Object StrictMath Void
Double Package String
Enum Process StringBuffer
Float ProcessBuilder StringBuilder
There are also two classes defined by theCharacterclass:Character.Subsetand
Character.UnicodeBlock.
java.langdefines the following interfaces:
Appendable Comparable Runnable
CharSequence Iterable
Cloneable Readable
Several of the classes contained injava.langcontain deprecated methods, most dating
back to Java 1.0. These deprecated methods are still provided by Java to support an ever-
shrinking pool of legacy code and are not recommended for new code. Most of the deprecations
took place prior to Java SE 6, and these deprecated methods are not discussed here.
385