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
    Modifier and Type
    Method
    Description
    protected Object
     
    final Class
    Returns the runtime class of an object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • 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)