10. The java.lang Package
Contents:
The package java.lang contains classes and interfaces that are essential to the Java language. These include:
Because the classes in the java.lang package are so essential, the java.lang package is implicitly imported by every Java source file. In other words, you can refer to all of the classes and interfaces in java.lang using their simple names. Figure 10.1 shows the class hierarchy for the java.lang package. BooleanNameBooleanSynopsis
DescriptionThe Boolean class provides an object wrapper for a boolean value. This is useful when you need to treat a boolean value as an object. For example, there are a number of utility methods that take a reference to an Object as one of their arguments. You cannot specify a boolean value for one of these arguments, but you can provide a reference to a Boolean object that encapsulates the boolean value. Furthermore, as of JDK 1.1, the Boolean class is necessary to support the Reflection API and class literals. Class Summary
public final class java.lang.Boolean { // Constants public final static Boolean FALSE; public final static Boolean TRUE; public final static Class TYPE; // New in 1.1 // Constructors public Boolean(boolean value); public Boolean(String s); // Class Methods public static boolean getBoolean(String name); public static Boolean valueOf(String s); // Instance Methods public boolean booleanValue(); public boolean equals(Object obj); public int hashCode(); public String toString(); } ConstantsTRUEpublic static final Boolean TRUE
FALSEpublic static final Boolean FALSE
TYPEpublic static final Class TYPE
ConstructorsBooleanpublic Boolean(boolean value)
public Boolean(String s)
Class MethodsgetBooleanpublic static boolean getBoolean(String name)
valueOfpublic static Boolean valueOf(String s)
Instance MethodsbooleanValuepublic boolean booleanValue()
equalspublic boolean equals(Object obj)
hashCodepublic int hashCode()
toStringpublic String toString()
Inherited Methods
|
|