Boolean class

The Boolean class wraps a primitive type boolean in an object. An object of type Boolean contains a single field whose type is boolean.

Boolean class has the methods for converting a boolean to a String and a String to a boolean.

Boolean constants

static Boolean FALSE
The Boolean object value false.
static Boolean TRUE
The Boolean object value true.

Constructor

Boolean(boolean value)
Creates a Boolean object for value.
Boolean(String s)
Creates a Boolean object true value for string "true" igoring case.

Convert to primitive boolean value

boolean booleanValue()
Returns the value as a boolean primitive.

Compare two boolean values

int compareTo(Boolean b)
Compares this Boolean instance with another.
boolean equals(Object obj)
Returns true if the argument is not null and is a Boolean object that represents the same boolean value as this object.

Get boolean system property

static boolean getBoolean(String name)
Gets system property.

Parse boolean value from string

static boolean parseBoolean(String s)
Parses the string argument as a boolean.
static Boolean valueOf(boolean b)
Returns a Boolean instance representing the specified boolean value.
static Boolean valueOf(String s)
Returns a Boolean with a value represented by the specified string.

Convert boolean value to string

String toString()
Returns a String object representing this Boolean's value.
static String toString(boolean b)
Returns a String object representing the specified boolean.
Home 
  Java Book 
    Essential Classes  

Boolean:
  1. Boolean class
  2. Get boolean value from constants in Boolean class
  3. Convert to primitive boolean value
  4. Use Boolean value constructors
  5. Compare two boolean values
  6. Get system property in boolean value
  7. Convert string to boolean
  8. Convert boolean to string