Name
Package java.lang
Synopsis
The java.lang package contains the classes that
are most central to the Java language. Object is
the ultimate superclass of all Java classes and is therefore at the
top of all class hierarchies. Class is a class
that describes a Java class. There is one Class
object for each class that is loaded into Java.
Boolean,
Character, Byte,
Short, Integer,
Long, Float, and
Double
are
immutable class wrappers around each of the
primitive Java data types. These
classes are useful when you need to manipulate primitive types as
objects. They also contain useful conversion and utility methods.
Void is a related class that defines a
representation for the void method return type,
but that defines no methods. String and
StringBuffer are objects that represent strings.
String is an immutable type, while
StringBuffer can have its string changed in place.
In Java 5.0, StringBuilder is like
StringBuffer but without
synchronized methods, which makes it the preferred
choice in most applications. String,
StringBuffer and StringBuilder
implement the Java 1.4 interface CharSequence
which allows instances of these classes to be manipulated through a
simple shared API.
String and the various primitive type wrapper
classes all implement the Comparable interface
which defines an ordering for instances of those classes and enables
sorting and searching algorithms (such as those of
java.util.Arrays and
java.util.Collections, for example).
Cloneable is an important marker ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access