Java – Boolean

Java – Boolean 2017-08-09T12:44:23+00:00

Java Boolean class :

Java Boolean class encapsulates a Boolean value. It defines FALSE and TRUE constants.

This class provides following constructors:

Boolean(Boolean b)

Boolean(String str)

Here, b is a Boolean value and str is the string equivalent of a Boolean value.

The methods associated with Boolean Class are as follows:

1. Boolean booleanValue()

2. Boolean equals(Boolean b)

3. String toString(Boolean b)

EX :


Output :
Object B1 = true
Object B2 = false
Object B3 = true
Object B4 = false
Boolean Value = true
(b1==b2)? false
String S1 true

Prev Next