集册 Java实例教程 如何声明和使用Java基本布尔变量

如何声明和使用Java基本布尔变量

欢马劈雪     最近更新时间:2020-01-02 10:19:05

440
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
如何声明和使用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);            

        }

}