第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何將 JOptionPane.showInputDialog 與數(shù)組一起使用?

如何將 JOptionPane.showInputDialog 與數(shù)組一起使用?

繁花不似錦 2023-10-19 21:13:57
我嘗試過僅使用字符串而不是數(shù)組中的數(shù)字,但它仍然不起作用。String [] seller  = { "Yeah", "Nah" ,"Depends on what it is"};      seller = (String[]) JOptionPane.showInputDialog(null, "Hey, you want to see something cool","Scam3r69 has entered chat", 1, null, seller, seller[1]); if (seller.equals(seller[2])){   JOptionPane.showMessageDialog(null, "Just let me say what it is okay");}else{   JOptionPane.showMessageDialog(null,"It's a chance to make 1 million dollars in 1 minute");  }我希望這樣,當(dāng)他們選擇“不”時(shí),會(huì)顯示一條消息,如果他們選擇其他任何內(nèi)容,我希望顯示另一條消息。運(yùn)行:在practice.pkg3.Practice3.main(Practice3.java:28) /Users/alexanderkiknadze/Library/Caches/NetBeans/8.2/executor-snippets/run.xml:53 線程“main”java.lang.NullPointerException 中出現(xiàn)異常: Java 返回: 1 BUILD FAILED (總時(shí)間: 12 秒)
查看完整描述

1 回答

?
慕婉清6462132

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超2個(gè)贊

您將 String[] 傳遞給 JOptionPane.showInputDialog。因此,根據(jù)選擇,您將得到一個(gè) String 而不是 String [] 。所以你應(yīng)該改變你的代碼

seller = (String[]) JOptionPane.showInputDialog(null, "Hey, you want to see something cool","Scam3r69 has entered chat", 1, null, seller, seller[1]);

String sellerInput = (String) JOptionPane.showInputDialog(null, "Hey, you want to see something cool","Scam3r69 has entered chat", 1, null, seller, seller[1]);

以便它將用數(shù)組檢查對(duì)話框中的輸入seller.equals(seller[2])。sellerInput.equals(seller[2])



查看完整回答
反對(duì) 回復(fù) 2023-10-19
  • 1 回答
  • 0 關(guān)注
  • 101 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)