Java boolean Keyword
In Java, the boolean keyword is a primitive data type. It is used to store only two possible values, either true or false. It specifies 1-bit of information and its "size" can't be defined precisely.
The boolean keyword is used with variables and methods. Its default value is false. It is generally associated with conditional statements.
Examples of Java boolean keyword
Example 1: Simple boolean exampleTest it Now
Example 2: Comparing the variables of boolean typeTest it Now
true false false
Example 3: Method of boolean typeTest it Now
Example 4: Comparing objectsTest it Now
Is objects are equal : false
Example 5: Finding a prime numberTest it Now