if else语句的结果如下
if(条件1){
//代码块1
}else if(条件2){
//代码块2
}else{//代码块3}
if else语句使用方法:如果条件1是true则执行 代码块1,如果条件2是true则执行代码块2,否则执行代码块3。下面是例子:
public class test {
public static void main(String[] args){
Boolean test =false;
if(test ==false){
System.out.println("1The test is ture");
}else {
System.out.println("1The test is false");
}
test =true;
if(test ==false){
System.out.println("2The test is ture");
}else {
System.out.println("2The test is false");
}
}
例子的结果是:
1The test is ture
2The test is false