Java 中的布尔值是什么?
布尔值只表示两个值 true 或 false。在 Java 中,值 1 被认为是 true,值 0 被认为是 false。
示例
public class Test{
public static void main(String args[]) throws Exception{
boolean bool1 = true;
boolean bool2 = false;
boolean bool = (25==(100/4));
System.out.println(bool1);
System.out.println(bool2);
System.out.println(bool);
}
}
输出
true false true
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP