Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public final class Boolean
- Object
- Boolean
ImplementsComparable<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. |
public static final Class<Boolean> TYPE |
Constructors
public Boolean(boolean value) | Allocates a Boolean object representing the value argument. |
public Boolean(String s) | Deprecated A Boolean of parseBoolean(s). |
Methods
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.
TYPE
public static final Class<Boolean> TYPEConstructor details
Boolean
public Boolean(boolean value)Allocates a Boolean object representing the value argument.
value - the value of the Boolean.
Boolean
public Boolean(String s)Deprecated.
A Boolean of
parseBoolean(s).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)Compares this object to the specified object to determine their relative
order.
Parameters
b2Boolean- the object to compare to this instance.
Returns
a negative integer if this instance is less than
another;
a positive integer if this instance is greater than
another; 0 if this instance has the same order as
another.Throws
ClassCastException- if
anothercannot be converted into something comparable tothisinstance.
toString
public static String toString(boolean b)"true" or "false".hashCode
public static int hashCode(boolean value)1231 for true, 1237 for false, as the JDK hashes them.
compare
public static int compare(boolean x, boolean y)0 when equal, otherwise positive when
x is true.logicalAnd
public static boolean logicalAnd(boolean a, boolean b)a && b.logicalOr
public static boolean logicalOr(boolean a, boolean b)a || b.logicalXor
public static boolean logicalXor(boolean a, boolean b)a ^ b.getBoolean
public static boolean getBoolean(String name)Whether the system property
name is "true", ignoring case.