java.lang
public
final
class
java.lang.Boolean
Boolean is the wrapper for the primitive type boolean
.
Summary
Constants
|
|
|
Value |
|
Boolean |
FALSE |
The instance of the receiver which represents falsehood. |
|
|
Boolean |
TRUE |
The instance of the receiver which represents truth. |
|
|
Class<Boolean> |
TYPE |
The java.lang.Class that represents this class. |
|
|
Public Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
public
static
final
Boolean
FALSE
The instance of the receiver which represents falsehood.
public
static
final
Boolean
TRUE
The instance of the receiver which represents truth.
public
static
final
Class<Boolean>
TYPE
The java.lang.Class that represents this class.
Public Constructors
public
Boolean(String string)
Constructs a new instance of this class given a string. If the string is
equal to "true" using a non-case sensitive comparison, the result will be
a Boolean representing true, otherwise it will be a Boolean representing
false.
Parameters
string
| The name of the desired boolean.
|
public
Boolean(boolean value)
Constructs a new instance of this class given true or false.
Public Methods
public
boolean
booleanValue()
Returns true if the receiver represents true and false if the receiver
represents false.
public
int
compareTo(Boolean that)
Compares this Boolean
to another Boolean
.
If this instance has the same value as the instance passed, then
0
is returned. If this instance is true
and
the instance passed is false
, then a positive value is
returned. If this instance is false
and the instance
passed is true
, then a negative value is returned.
Parameters
that
| The instance to compare to. |
public
boolean
equals(Object o)
Compares the argument to the receiver, and returns true if they represent
the
same object using a class specific comparison.
In this case, the argument must also be a Boolean, and the receiver and
argument must represent the same boolean value (i.e. both true or both
false).
Parameters
o
| the object to compare with this object |
Returns
true
if the object is the same as this object
false
if it is different from this object
public
static
boolean
getBoolean(String string)
Returns true if the system property described by the argument equal to
"true" using case insensitive comparison, and false otherwise.
Parameters
string
| The name of the desired boolean. |
public
int
hashCode()
Returns an integer hash code for the receiver. Any two objects which
answer
true
when passed to
equals
must
answer the same value for this method.
public
static
boolean
parseBoolean(String s)
Parses the string as a boolean
. If the string is not
null
and is equal to "true"
, regardless
case, then true
is returned, otherwise false
.
public
static
String
toString(boolean value)
Converts the specified boolean to its string representation. When the
boolean is true answer
"true"
, otherwise answer
"false"
.
Returns
- the boolean converted to a string
public
String
toString()
Returns a string containing a concise, human-readable description of the
receiver.
Returns
- a printable representation for the receiver.
public
static
Boolean
valueOf(String string)
Returns a Boolean representing true if the argument is equal to "true"
using case insensitive comparison, and a Boolean representing false
otherwise.
Parameters
string
| The name of the desired boolean. |
public
static
Boolean
valueOf(boolean b)
Returns Boolean.TRUE if the argument is equal to "true" using case
insensitive comparison, and Boolean.FALSE representing false otherwise.
Returns
- Boolean.TRUE or Boolean.FALSE Global true/false objects.