岁月静好15
2016-05-04 11:15
利用if语句来判定通过与否,不需要自己判断,如何编写
// 定义常量
final String AGREE = "通过";
// 定义判断变量
String a = "通过";
String b = "不通过";
// 如果任意一个变量等于常量通过,且两个变量的值相同,则判断为通过
if(AGREE.equals(a) && a.euqals(b)){
System.out.println("通过");
}else{
System.out.println("未通过");
}
str a="通过";
str b="未通过";
if(a&&b){
System.out.println("通过")
}
else{
System.out.println("未通过")
}
Java入门第一季(IDEA工具)
1168093 学习 · 18754 问题
相似问题