Understanding boolean data type
The java boolean data type declaration and its features.
- Declaration and initialisation of boolean type.
- Non-convertibility of boolean type to other types.
Here we declare boolean data type b which is assigned a true status. true in java is just a reserved word to be used as boolean literal. The opposite of this is false.
This line has been commented. If we un-comment this the code will not run as boolean type can not be converted to other type
The boolean type can be directly checked in if conditions without using any comparison operator.
However the use of comparison operator with boolean type is also allowed.
Suggested Filename(s): BooleanType.java
sunmitra| Created: 19-Mar-2018 | Updated: 19-Mar-2018|