62,623
社区成员
发帖
与我相关
我的任务
分享//:Test.java
public class Test {
public static void main(String[] args) {
TestBoolean t = new TestBoolean();
t.aa();
}
}
class TestBoolean {
boolean end;
public void aa() {
if(end) {
System.out.println("boolean 默认值是true");
} else {
System.out.println("boolean 默认值是false");
}
}
}boolean end;
//如果end=true时就执行if中的代码
if(end){ // ??????
boolean isLeapYear = false;
if(isLeapYear) // 这里等同于 isLeapYear == true 不过一般都这样简写了,效率更高
System.out.print("闰年");
else
System.out.print("不是闰年")
boolean isLeapYear = false;
if(isLeapYear) // 这里等同于 isLeapYear = true 不过一般都这样简写了,效率更高
System.out.print("闰年");
else
System.out.print("不是闰年");