Introduction to java.lang
The java.lang package provides classes that are fundamental to the design of the Java programming language. It is the most important package in Java.
The Object Class
The java.lang.Object class is the parent class of all classes in Java by default. In other words, it is the topmost class of Java's class hierarchy.
The String Class
In Java, a String is an object that represents a sequence of characters. The java.lang.String class is used to create and manipulate strings.
StringBuffer & StringBuilder
As we learned in the previous section, String objects are immutable. If your application involves heavy string manipulation (like in a loop), using String will create thousands of abandoned objects in the memory, severely impacting performance.
Wrapper Classes
Java is an object-oriented programming language, which means everything should theoretically be an object. However, for performance reasons, Java provides eight primitive data types (int, char, double, boolean, etc.) that are not objects.
The System Class
The java.lang.System class contains several useful class fields and methods. It cannot be instantiated because its constructor is private. Among the facilities provided by the System class are standard input, standard output, and error output streams, as well as access to externally defined properties and environment variables.
The Math Class
The java.lang.Math class contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.