Name

Boolean

Synopsis

This class provides an immutable object wrapper around the boolean primitive type. Note that the TRUE and FALSE constants are Boolean objects; they are not the same as the true and false boolean values. As of Java 1.1, this class defines a Class constant that represents the boolean type. booleanValue( ) returns the boolean value of a Boolean object. The class method getBoolean( ) retrieves the boolean value of a named property from the system property list. The static method valueOf( ) parses a string and returns the Boolean object it represents. Java 1.4 added two static methods that convert primitive boolean values to Boolean and String objects. In Java 5.0, the parseBoolean( ) method behaves like valueOf( ) but returns a primitive boolean value instead of a Boolean object.

Prior to Java 5.0, this class does not implement the Comparable interface.

java.lang.Boolean

Figure 10-7. java.lang.Boolean

public final class Boolean implements Serializable, Comparable<Boolean> {
// Public Constructors
     public Boolean(String s);  
     public Boolean(boolean value);  
// Public Constants
     public static final Boolean FALSE;  
     public static final Boolean TRUE;  
1.1  public static final Class<Boolean> TYPE;  
// Public Class Methods
     public static boolean getBoolean(String name);  
5.0  public static boolean parseBoolean(String s);  
1.4  public static String toString(boolean b);  
1.4  public static Boolean valueOf(boolean ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.