10.1 Overview of the 'java.lang' Package

The java.lang package is indispensable when programming in Java. It is automatically imported into every source file at compile time. The package contains the Object class that is the mother of all classes, and the wrapper classes (Boolean, Character, Byte, Short, Integer, Long, Float, Double) used to handle primitive values as objects. It provides classes essential for interacting with the JVM (Runtime), for security (SecurityManager), for loading classes (ClassLoader), for dealing with threads (Thread), and for exceptions (Throwable). The java.lang package also contains classes that provide the standard input, output, and error streams (System), string handling (String, StringBuffer), and mathematical functions (Math).

Figure 10.1 shows the important classes that are discussed in detail in this chapter.

Figure 10.1. Partial Inheritance Hierarchy in the java.lang Package