為什么運行不成功
int score=94;
String sex="女";
if (score>80) {
if (sex.equals("男")) {
System.out.println("進入男子組決賽");
}else {
System.out.println("進入女子組決賽");
}
}else {
System.out.println("淘汰");
int score=94;
String sex="女";
if (score>80) {
if (sex.equals("男")) {
System.out.println("進入男子組決賽");
}else {
System.out.println("進入女子組決賽");
}
}else {
System.out.println("淘汰");
2020-01-16
舉報
2020-01-18
很簡單,因為你else語句后面System.out.println("淘汰");少一個 }
2020-01-17
怎么感覺你 if else 的括號都沒對的上呢
2020-01-16
代碼沒錯誤,應該是你大括號邏輯塊的問題,看看是不是多了或者少了,而且淘汰的代碼塊是最外層的代碼塊,不要跟內(nèi)層弄混了。