笑话大全网 - 笑话段子 - 很简单的java布尔小说明 请人讲解一下

很简单的java布尔小说明 请人讲解一下

首先更正你的几个拼写错误:1:boollean应该为:boolean

2:ture应该为:true

进入回答:

if(b)就是个判断句

若b=true就执行System.out.println("this is executed."); 就是打印:

"this is executed."

若为false则什么都不做,就像你的第二个if(b)后面那句System.out.println("this is not executed."); 就不会执行!!!

这样将你懂了吗?

若还不懂我在举个例子:

b=false;

if(b)

System.out.println("this is true.");

else

System.out.println("this is false.");

此例因为b=false,所以执行System.out.println("this is false.");

这样应该懂了!!!!