這個(gè)為什么運(yùn)行失敗啊,他告訴我只有else without if???
public class HelloWord {
? ? public static void main(String[] args) {
? ? ? ? int score =94;
? ? ? ? String sex="女";
? ? ? ? if (score>80) {
? ? ? ? ? ? if (sex.equals('男')) ;
? ? ? ? ? ? {
? ? ? ? ? ? ? ? System.out.println("進(jìn)入男子決賽");
? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? System.out.println("進(jìn)入女子決賽");
? ? ? ? ? ? }
? ? ? ? }else{
? ? ? ? ? ? System.out.println("淘汰");
? ? ? ? }
? ? ? ? }
}
2020-10-10
?if (sex.equals('男')) ; 將 ;?去掉即可
2021-07-13
雙引號(hào)錯(cuò)了還有;
2020-11-22
只能有一個(gè)else,一個(gè)if,其他用else if
2020-10-18
還有('男')里的符號(hào) '' 換成 ""