78
Java Boolean booleanValue() method
The booleanValue() method of Java Boolean class returns the primitive Boolean value of this Boolean object.
Syntax:
Parameters:
NA
Return Value:
This method returns the primitive Boolean value of this Boolean object.
Example 1
Output:
1. Value of boolean object true is true. 2. Value of boolean object true is true.
Example 2
Output:
Elements are: 0 1 2 3 4 5 Stop value is false
Example 3
Output:
Enter two number I no:89 II no:90 90 is greater.
Example 4
Output:
Error:(4, 24) java: boolean cannot be dereferenced
The Boolean is a primitive data type. Its object can’t be used to call the Boolean class method. If done, so it will give the above error.
Next TopicJava Boolean