Boolean class is the wrapper class for values of the primitive
type boolean. An object of type Boolean contains a
single field whose type is boolean.
In addition, this class provides many methods for
converting a boolean to a String and a
String to a boolean, as well as other
constants and methods useful when dealing with a
boolean.
This is a value-based class; programmers should treat instances that are equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail.
| Modifier and Type | Field and Description |
|---|---|
| public static final Boolean | FALSE
The |
| private static final long | serialVersionUID
use serialVersionUID from JDK 1.0.2 for interoperability |
| public static final Boolean | TRUE
The |
| public static final Class | TYPE
The Class object representing the primitive type boolean. |
| private final boolean | value
The value of the Boolean. |
| Access | Constructor and Description |
|---|---|
| public | Boolean(boolean
the value of the value)Boolean.
Deprecated
since 9. It is rarely appropriate to use this constructor.
Allocates a |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: the primitiveboolean value of this object.Returns the value of this |
| public static int | Returns: the value0 if x == y;
a value less than 0 if !x && y; and
a value greater than 0 if x && !ythe first x, boolean boolean to comparethe second y)boolean to compareCompares two |
| public int | Returns: zero if this object represents the same boolean value as the argument; a positive value if this object represents true and the argument represents false; and a negative value if this object represents false and the argument represents truethe b)Boolean instance to be comparedImplements java. Compares this |
| public Optional | describeConstable()
Implements java. Returns an |
| public boolean | Returns: true if the Boolean objects represent the
same value; false otherwise.the object to compare with. obj)Overrides java. Returns |
| public static boolean | Returns: theboolean value of the system property.the system property name. name)Returns |
| public int | Returns: the integer1231 if this object represents
true; returns the integer 1237 if this
object represents false.Overrides java. Returns a hash code for this |
| public static int | Returns: a hash code value for aboolean value.the value to hash value)Returns a hash code for a |
| public static boolean | Returns: the logical AND ofa and bthe first operand a, boolean the second operand b)Returns the result of applying the logical AND operator to the
specified |
| public static boolean | Returns: the logical OR ofa and bthe first operand a, boolean the second operand b)Returns the result of applying the logical OR operator to the
specified |
| public static boolean | Returns: the logical XOR ofa and bthe first operand a, boolean the second operand b)Returns the result of applying the logical XOR operator to the
specified |
| public static boolean | Returns: the boolean represented by the string argumentthe s)String containing the boolean
representation to be parsedParses the string argument as a boolean. |
| public static String | Returns: the string representation of the specifiedbooleanthe boolean to be converted b)Returns a |
| public String | Returns: a string representation of this object.Overrides java. Returns a |
| public static Boolean | Returns: aBoolean instance representing b.a boolean value. b)Returns a |
| public static Boolean |
| FALSE | back to summary |
|---|---|
| public static final Boolean FALSE The | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID use serialVersionUID from JDK 1.0.2 for interoperability | |
| TRUE | back to summary |
|---|---|
| public static final Boolean TRUE The | |
| TYPE | back to summary |
|---|---|
| public static final Class<Boolean> TYPE The Class object representing the primitive type boolean.
| |
| value | back to summary |
|---|---|
| private final boolean value The value of the Boolean. | |
| Boolean | back to summary |
|---|---|
| public Boolean(boolean value)
Deprecated since 9. It is rarely appropriate to use this constructor. The static factory
Allocates a
| |
| Boolean | back to summary |
|---|---|
| public Boolean(String s)
Deprecated since 9. It is rarely appropriate to use this constructor.
Use Allocates a
| |
| booleanValue | back to summary |
|---|---|
| public boolean booleanValue() Returns the value of this
| |
| compare | back to summary |
|---|---|
| public static int compare(boolean x, boolean y) Compares two Boolean.valueOf(x).compareTo(Boolean.valueOf(y))
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(Boolean b) Implements java. Compares this
| |
| describeConstable | back to summary |
|---|---|
| public Optional Implements java. Returns an | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Returns
| |
| getBoolean | back to summary |
|---|---|
| public static boolean getBoolean(String name) Returns If there is no
property with the specified name, or if the specified name is
empty or null, then
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns a hash code for this
| |
| hashCode | back to summary |
|---|---|
| public static int hashCode(boolean value) Returns a hash code for a
| |
| logicalAnd | back to summary |
|---|---|
| public static boolean logicalAnd(boolean a, boolean b) Returns the result of applying the logical AND operator to the
specified
| |
| logicalOr | back to summary |
|---|---|
| public static boolean logicalOr(boolean a, boolean b) Returns the result of applying the logical OR operator to the
specified
| |
| logicalXor | back to summary |
|---|---|
| public static boolean logicalXor(boolean a, boolean b) Returns the result of applying the logical XOR operator to the
specified
| |
| parseBoolean | back to summary |
|---|---|
| public static boolean parseBoolean(String s) Parses the string argument as a boolean. The
Example:
| |
| toString | back to summary |
|---|---|
| public static String toString(boolean b) Returns a
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a | |
| valueOf | back to summary |
|---|---|
| public static Boolean valueOf(boolean b) Returns a
| |
| valueOf | back to summary |
|---|---|
| public static Boolean valueOf(String s) Returns a | |