Java Boolean Declaration: Complete Guide
In Java, the boolean type is used to represent true or false values. When declaring a variable of boolean type, you can use the keyword boolean like shown below:
boolean flag = true; // 声明一个名为flag的boolean变量,并赋值为true
In Java, a boolean variable can only store two values, true or false, and cannot store any other type of value.