|
The java.lang package contains the fundamental classes of the Java language. For this reason, all classes in the java.lang package are imported automatically in a Java code. Therefore, you need not write an import statement while using them in your code. There are many classes in java.lang, but we will see only the prominent ones (from the exam point of view).
The Object class is one of the most fundamental classes of Java. All Java classes inherit from this class. In other words, this class is the granddaddy of all classes. Besides Object, the package java.lang also defines the String, StringBuffer classes representing a sequence of characters and the wrapper classes for all primitive types (and also for the void type). The wrapper classes have similar name to the type they are wrapping. They are Boolean, Byte, Short, Character, Integer, Long, Float, Double and Void.
![]() |
Figure 13.1 Some of the important classes including the wrapper classes in java.lang package
Besides the classes shown in figure 13.1, the java.lang package also contains other important classes such as Thread class and interfaces Runnable, Serializable etc. Since we have already studied some of them, we will be learning about the classes which we haven’t seen so far. Let us start with the Math class first.