提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
如何声明和使用Java基本布尔变量
public class Main { // 来 自 n o w j a v a . c o m public static void main(String[] args) { boolean b1 = true; boolean b2 = false; boolean b3 = (5 > 2)? true:false; System.out.println("Value of boolean variable b1 is :" + b1); System.out.println("Value of boolean variable b2 is :" + b2); System.out.println("Value of boolean variable b3 is :" + b3); } }