Boolean

public final class Boolean
extends Object implements Comparable<Boolean>, Serializable

java.lang.Object
   ↳ java.lang.Boolean


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.

In addition, this class provides many methods for converting a boolean to a String and a String to a boolean, as well as other constants and methods useful when dealing with a boolean.

This is a value-based class; programmers should treat instances that are equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail.

Summary

Fields

public static final Boolean FALSE

The Boolean object corresponding to the primitive value false.

public static final Boolean TRUE

The Boolean object corresponding to the primitive value true.

public static final Class<Boolean> TYPE

The Class object representing the primitive type boolean.

Public constructors

Boolean(boolean value)

This constructor is deprecated. It is rarely appropriate to use this constructor. The static factory valueOf(boolean) is generally a better choice, as it is likely to yield significantly better space and time performance. Also consider using the final fields TRUE and FALSE if possible.

Boolean(String s)

This constructor is deprecated. It is rarely appropriate to use this constructor. Use parseBoolean(String) to convert a string to a boolean primitive, or use valueOf(String) to convert a string to a Boolean object.

Public methods

boolean booleanValue()

Returns the value of this Boolean object as a boolean primitive.

static int compare(boolean x,