public final class Boolean
- Object
- Boolean
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.
Since: JDK1.0, CLDC 1.0
Fields
public static final Boolean FALSE | The Boolean object corresponding to the primitive value false. |
public static final Boolean TRUE | The Boolean object corresponding to the primitive value true. |
Constructors
public Boolean(boolean value) | Allocates a Boolean object representing the value argument. |
Methods
public boolean booleanValue() | Returns the value of this Boolean object as a boolean primitive. |
public boolean equals(Object obj) | Returns true if and only if the argument is not null and is a Boolean object that represents the same boolean value as this object. |
public int hashCode() | Returns a hash code for this Boolean object. |
public String toString() | Returns a String object representing this Boolean’s value. |
public static Boolean valueOf(boolean b) | Returns the object instance of i |
public static Boolean valueOf(String b) | |
public static boolean parseBoolean(String s) | |
public int compareTo(Boolean b2) |
Inherited methods
Field details
FALSE
public static final Boolean FALSEThe Boolean object corresponding to the primitive value false.
TRUE
public static final Boolean TRUEThe Boolean object corresponding to the primitive value true.
Constructor details
Boolean
public Boolean(boolean value)Allocates a Boolean object representing the value argument.
value - the value of the Boolean.
Method details
booleanValue
public boolean booleanValue()Returns the value of this Boolean object as a boolean primitive.
equals
public boolean equals(Object obj)Returns true if and only if the argument is not null and is a Boolean object that represents the same boolean value as this object.
hashCode
public int hashCode()Returns a hash code for this Boolean object.
toString
public String toString()Returns a String object representing this Boolean’s value. If this object represents the value true, a string equal to “true” is returned. Otherwise, a string equal to “false” is returned.
valueOf
public static Boolean valueOf(boolean b)Returns the object instance of i
Parameters
bboolean- the primitive
Returns
object instance
valueOf
public static Boolean valueOf(String b)parseBoolean
public static boolean parseBoolean(String s)compareTo
public int compareTo(Boolean b2)