請教大神!看看哪里有錯(cuò)了。
public?class?HelloWorld?{ public?static?void?main(String[]?args){ String?today="周末"; ?????String?weather="晴朗"; ?????if(today.equals("周末")){ ???????if(weather.equals("晴朗")){ ?????????System.out.println("去室外玩");????? ?????????}else{ ???????????System.out.println("去室內(nèi)玩"); ?????????}else{ ????????????System.out.println("去上班"); ????????????????} ???????????} ????} }
2017-01-16
去上班是跟第一個(gè)IF同層,你寫在IF里面了
2017-01-10
你把最后一個(gè)else寫在了第二個(gè)循環(huán)里面
2016-12-17
謝謝你!
2016-12-17
看符號是不是英文半角符號
看看{}是否對應(yīng)的正確
代碼中有兩個(gè)if-else結(jié)構(gòu)(這應(yīng)該是出錯(cuò)的地方)
?if(today.equals("周末")){
???????????if(weather.equals("晴朗")){
?????????????System.out.println("去室外玩");?????
?????????????}else{
???????????????System.out.println("去室內(nèi)玩");
?????????????}
}else{
????????????????System.out.println("去上班");
?}