亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么兩個小程序就會在第二個int出錯呢

package com.demo;


public class Day301 {

public static void main(String[] args) {

int score=5;

if(score>30){

? ?System.out.println("優秀");

}else if(score>20){

? ?System.out.println("剛剛好");

}else if(score<20){

? ? ? ?System.out.println("媽的智障");

? ?}

}

? ? ? ? int age=25;

if(age>60){

? ?System.out.println("老年,就該去頤養天年");

}else if(age>40){

? ?System.out.println("中年需要奮斗");

? }else if(age>18){

? ? ? ?System.out.println("少年,一起去屠龍吧");

? ?}else?

? ? ? ?System.out.println("童年,活該你無憂無慮,其實我也想回到童年");

?

}

}


? ?



正在回答

2 回答

//都是語法書寫錯誤

public?class?Day301?{
public?static?void?main(String[]?args)?{
int?score=5;
if(score>30)
??????System.out.println("優秀");
else?if(score>20){
??????System.out.println("剛剛好");
}else?if(score<20){
???????System.out.println("媽的智障");
}else;



int?age=25;

if(age>60)
??????System.out.println("老年,就該去頤養天年");
else?if(age>40)
??????System.out.println("中年需要奮斗");
else?if(age>18)
???????System.out.println("少年,一起去屠龍吧");
else?
???????System.out.println("童年,活該你無憂無慮,其實我也想回到童年");
?
?}

}


0 回復 有任何疑惑可以回復我~

你把 int age = 25; 上面那個 } 刪掉就可以了。? 這個是多余的。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么兩個小程序就會在第二個int出錯呢

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號