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.
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 ...
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