Java – Boolean

Java – Boolean 2017-06-13T01:06:38+00:00

Boolean class :

The 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