The Boolean
class in Java is a wrapper class for the primitive type boolean
. It provides methods to convert a boolean value to a string and a string to a boolean value, as well as other constants and methods useful when dealing with boolean values. Understanding these methods is crucial for efficient boolean manipulation in Java.
This guide covers various methods available in the Boolean
class, offering a comprehensive understanding of how to manipulate and interact with boolean values in Java. These methods are essential for efficient coding practices and help in performing operations like parsing, comparing, and converting boolean values.
For more detailed information, you can refer to the official Java SE Documentation and additional resources on Java Programming Tutorial.
Java Boolean Class Methods
Method | Description |
---|---|
booleanValue() | Returns the value of this Boolean object as a boolean primitive. |
compare() | Compares two boolean values. |
compareTo() | Compares this Boolean object with another. |
getBoolean() | Returns the boolean value of the system property with the specified name. |
logicalAnd() | Returns the result of the logical AND operation. |
logicalOr() | Returns the result of the logical OR operation. |
logicalXor() | Returns the result of the logical XOR operation. |
toString() | Returns a string representation of this Boolean object. |
parseBoolean() | Parses the string argument as a boolean. |
valueOf() | Returns a Boolean instance representing the specified boolean value. |
References: