class eee { public static void main(String[] args){ char c= sex? '男':'女'; double score=95,score1=77; boolean sex=true; if((c=='男') && (score<=100) && (score>=80)){ System.out.println("可以进入男子决赛"); }else{ System.out.println("不可以进入决赛"); }if((c!='女') && (score1<=100) && (score1>=80)){ System.out.println("可以进入女子决赛"); }else{ System.out.println("不可以进入决赛"); } }}
4 回答
已采纳

一桶冰红茶
TA贡献1条经验 获得超2个赞
在编程中,通常比较两个字符串是否相同的表达式是“==”,但在Java中不能这么写。在Java中,如果要比较a字符串是否等于b字符串,需要这么写:
if(a.equals(b)){
}

黑色月神
TA贡献1条经验 获得超0个赞
搞错了,是这样的
class eee {
public static void main(String[] args){
double score=95,score1=77;
boolean sex=true;
char c= sex? '男':'女';
if((c=='男') && (score<=100) && (score>=80)){
System.out.println("可以进入男子决赛");
}else{
System.out.println("不可以进入男子决赛");
}if((c!='女') && (score1<=100) && (score1>=80)){
System.out.println("可以进入女子决赛");
}else{
System.out.println("不可以进入女子决赛");
}
}
}
添加回答
举报
0/150
提交
取消