跟答案一樣啊,為什么不能運行
public class HelloWorld {
? ? public static void main(String[] args) {
int age=25;
if(age > 60){
? ? System.out.println("老年");
}
else if(age > 40){
? ? System.out.println("中年");
}
else if(age > 18){
? ? System.out.println("少年");
}
? ? else if{
? ? ? ? System.out.println("童年");
? ? }
}
}
2021-05-19
else{ ????????System.out.println("童年");???? ????????} 最后應該是else不是else?if?,else?if是要加判斷條件的,你沒有判斷條件肯定就是錯了 或者可以寫成 else?if(age<18){ ????????System.out.println("童年");???? ????????}