Intel

Developer Zone

Boolean

java.lang

Class Boolean



  • public class Boolean
    extends Object
    • Field Summary

      Fields
      Modifier and Type Field and Description
      static Boolean FALSE
      The Boolean object that represents the primitive value false.
      static Boolean TRUE
      The Boolean object that represents the primitive value true.
    • Constructor Summary

      Constructors
      Constructor and Description
      Boolean(boolean value)
      Constructs a new Boolean with the specified primitive boolean value.
    • Method Summary

      Methods
      Modifier and Type Method and Description
      boolean booleanValue()
      Gets the primitive value of this boolean, either true or false.
      boolean equals(Object o)
      Compares this instance with the specified object and indicates if they are equal.
      int hashCode()
      Returns an integer hash code for this boolean.
      String toString()
      Returns a string containing a concise, human-readable description of this boolean.
      static Boolean valueOf(boolean b)
      Returns a Boolean instance for the specified boolean value.
    • Field Detail

      • TRUE

        public static final Boolean TRUE
        The Boolean object that represents the primitive value true.
      • FALSE

        public static final Boolean FALSE
        The Boolean object that represents the primitive value false.
    • Constructor Detail

      • Boolean

        public Boolean(boolean value)
        Constructs a new Boolean with the specified primitive boolean value.
        Parameters:
        value - the primitive boolean value, true or false.
    • Method Detail

      • booleanValue

        public boolean booleanValue()
        Gets the primitive value of this boolean, either true or false.
        Returns:
        this object's primitive value, true or false.
      • equals

        public boolean equals(Object o)
        Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must be an instance of Boolean and have the same boolean value as this object.
        Overrides:
        equals in class Object
        Parameters:
        o - the object to compare this boolean with.
        Returns:
        true if the specified object is equal to this Boolean; false otherwise.
        See Also:
        Object.hashCode()
      • hashCode

        public int hashCode()
        Returns an integer hash code for this boolean.
        Overrides:
        hashCode in class Object
        Returns:
        this boolean's hash code, which is 1231 for true values and 1237 for false values.
        See Also:
        Object.equals(java.lang.Object)
      • toString

        public String toString()
        Returns a string containing a concise, human-readable description of this boolean.
        Overrides:
        toString in class Object
        Returns:
        "true" if the value of this boolean is true, "false" otherwise.
      • valueOf

        public static Boolean valueOf(boolean b)
        Returns a Boolean instance for the specified boolean value.

        If it is not necessary to get a new Boolean instance, it is recommended to use this method instead of the constructor, since it returns its static instances, which results in better performance.

        Parameters:
        b - the boolean to convert to a Boolean.
        Returns:
        Boolean.TRUE if b is equal to true, Boolean.FALSE otherwise.