java.lang
Class Boolean
java.lang.Object
|
+--java.lang.Boolean
- public final class Boolean
- extends Object
The Boolean class wraps a value of the primitive type
boolean
in an object. 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
.
- Since:
- JDK1.0
Constructor Summary |
Boolean(boolean value)
Allocates a Boolean object representing the
value argument. |
Method Summary |
boolean |
booleanValue()
Returns the value of this Boolean object as a boolean. |
boolean |
equals(Object obj)
Returns true if and only if the argument is not
null and is a Boolean object that
contains the same boolean value as this object. |
int |
hashCode()
Returns a hash code for this Boolean. |
Boolean
public Boolean(boolean value)
- Allocates a
Boolean
object representing the
value
argument.
- Parameters:
value
- the value of the Boolean
.- Since:
- JDK1.0
booleanValue
public boolean booleanValue()
- Returns the value of this Boolean object as a boolean.
- Returns:
- the primitive
boolean
value of this object. - Since:
- JDK1.0
hashCode
public int hashCode()
- Returns a hash code for this Boolean.
- Overrides:
- hashCode in class Object
- Returns:
- a hash code value for this object.
- Since:
- JDK1.0
equals
public boolean equals(Object obj)
- Returns
true
if and only if the argument is not
null
and is a Boolean
object that
contains the same boolean
value as this object.
- Overrides:
- equals in class Object
- Parameters:
obj
- the object to compare with.- Returns:
true
if the objects are the same;
false
otherwise.- Since:
- JDK1.0