FileDocCategorySizeDatePackage
Boolean.javaAPI DocphoneME MR2 API (J2ME)3308Wed May 02 17:59:54 BST 2007java.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.
version
1.37, 12/04/99 (CLDC 1.0, Spring 2000)
since
JDK1.0

Fields Summary
private boolean
value
The value of the Boolean.
Constructors Summary
public Boolean(boolean value)
Allocates a Boolean object representing the value argument.

param
value the value of the Boolean.

        this.value = value;
    
Methods Summary
public booleanbooleanValue()
Returns the value of this Boolean object as a boolean primitive.

return
the primitive boolean value of this object.

        return value;
    
public booleanequals(java.lang.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.

param
obj the object to compare with.
return
true if the Boolean objects represent the same value; false otherwise.

        if (obj instanceof Boolean) {
            return value == ((Boolean)obj).booleanValue();
        }
        return false;
    
public inthashCode()
Returns a hash code for this Boolean object.

return
the integer 1231 if this object represents true; returns the integer 1237 if this object represents false.

        return value ? 1231 : 1237;
    
public java.lang.StringtoString()
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.

return
a string representation of this object.

      return value ? "true" : "false";