The usage of boolean type is the boolean [logical] data type in java. In java, boolean values can only be true and false, but cannot be replaced by 0 and 1, and must be lowercase. The code is [var myBoolean = new Boolean()].
Usage of boolean type in java:
boolean
isjava# The Boolean (logical) data type in ##, in Java, the boolean values can only be true and false, and cannot be replaced by 0 and 1, and must be lowercase.
truerepresents "true",
falserepresents "false". General relational operators return Boolean results. In addition, numeric values 0, -0, special values null, NaN, undefined, and the null character ("") will be interpreted as false, and other values will be interpreted as true.
Extended information
How to create a boolean object in java: 1. Use the keyword new to Define a Boolean object. The following code defines a logical object named myBoolean:var myBoolean = new Boolean() var myBoolean = new Boolean()
var myBoolean = new Boolean(); var myBoolean = new Boolean(0); var myBoolean = new Boolean(null); var myBoolean = new Boolean(""); var myBoolean = new Boolean(NaN);
var myBoolean = new Boolean(1); var myBoolean = new Boolean(true); var myBoolean = new Boolean("true"); var myBoolean = new Boolean("false"); var myBoolean = new Boolean("Bill Gates");
Related learning recommendations:
The above is the detailed content of How to use boolean type in java?. For more information, please follow other related articles on the PHP Chinese website!