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. Since: JDK1.0, CLDC 1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Boolean
    The Boolean object corresponding to the primitive value false.
    static final Boolean
    The Boolean object corresponding to the primitive value true.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Boolean(boolean value)
    Allocates a Boolean object representing the value argument.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of this Boolean object as a boolean primitive.
    int
     
    boolean
    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.
    int
    Returns a hash code for this Boolean object.
    static boolean
     
    Returns a String object representing this Boolean's value.
    static Boolean
    valueOf(boolean b)
    Returns the object instance of i
    static Boolean
     

    Methods inherited from class Object

    clone, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • FALSE

      public static final Boolean FALSE
      The Boolean object corresponding to the primitive value false.
    • TRUE

      public static final Boolean TRUE
      The 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.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns a hash code for this Boolean object.
      Overrides:
      hashCode in class 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.
      Overrides:
      toString in class Object
    • valueOf

      public static Boolean valueOf(boolean b)
      Returns the object instance of i
      Parameters:
      b - 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)