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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在 prograde 中使用一次 JOptionPane.showMessageDialog

如何在 prograde 中使用一次 JOptionPane.showMessageDialog

慕斯709654 2021-09-29 13:41:31
您使用了多少次語句:JOptionPane.showMessageDialog?如果您的答案不止一次,請返回并修改您的代碼,以便您只使用一個 JOptionPane.showMessageDialog提示:考慮使用名為 output 的 String 類型變量代碼如果(信用> = 120)  {     JOptionPane.showMessageDialog(null,"You've graduated!");  }//end if  else if(credit >= 90)  {     JOptionPane.showMessageDialog(null,"You're a senior.");  }//end if  else if(credit >= 60)  {     JOptionPane.showMessageDialog(null,"You're a junior.");  }//end if  else if(credit >= 30)  {     JOptionPane.showMessageDialog(null,"You're a sophomore.");  }//end if  else if(credit >=0)  {     JOptionPane.showMessageDialog(null,"You're a freshment.");  }//end if  else  {     JOptionPane.showMessageDialog(null,"invalid input");
查看完整描述

2 回答

?
POPMUISE

TA貢獻1765條經驗 獲得超5個贊

//不要忘記導入JOptionPane庫


//我也不知道你是如何使用你的信用變量 public class prograde { public void showJoption(String position) { JOptionPane.showMessageDialog(null, position); }


public static void main(String[] args)

{

    //this is the class object that you can use to call the showJoption() method.

    prograde display = new prograde();


    if(credit >= 120)

    {

        display.showJoption("You've graduated!");

    }

    else if (credit >= 90)

    {

        display.showJoption("You're a senior.");

    }

    else if (credit >= 60)

    {

        display.showJoption("You're a junior.");

    }

    else if (credit >= 30)

    {

        display.showJoption("You're a sophomore.");

    }

    else if (credit >= 0)

    {

        display.showJoption("You're a freshment.");

    }

    else {

        display.showJoption("invalid input");

    }

}   

}


查看完整回答
反對 回復 2021-09-29
?
aluckdog

TA貢獻1847條經驗 獲得超7個贊

使用 if-else 語句生成要顯示的字符串,然后使用單行調用showMessageDialog()使用該字符串。


查看完整回答
反對 回復 2021-09-29
  • 2 回答
  • 0 關注
  • 212 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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