java lang Boolean Class - java.lang.Boolean Class in Java
Boolean Class in Java
The Boolean class wraps the value of primitive data type boolean into Boolean object. An object of type Boolean contains a single field whose type is boolean. In other words the wrapper classes create objects for primitive data types. The wrapper classes are Boolean, Byte, Character, Short, Integer, Float, Long and Double.
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.
What is the Initial or Default Value of a Boolean in Java ?
The default value for a Boolean (object) is null.
The default value for a boolean (primitive) is false.
The default value of any Object, such as Boolean, is null.
java.lang.Boolean Class Example
java.lang.Boolean Class Example 2
In the following example you can learn how to use static methods of Boolean Class. If you use static methods you need not to create the class instance. You can call static methods using the class name as reference.
java.lang.Boolean Class Example 3