我尝试过仅使用字符串而不是数组中的数字,但它仍然不起作用。
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");
}
我希望这样,当他们选择“不”时,会显示一条消息,如果他们选择其他任何内容,我希望显示另一条消息。
运行:在practice.pkg3.Practice3.main(Practice3.java:28) /Users/alexanderkiknadze/Library/Caches/NetBeans/8.2/executor-snippets/run.xml:53 线程“main”java.lang.NullPointerException 中出现异常: Java 返回: 1 BUILD FAILED (总时间: 12 秒)
慕婉清6462132
相关分类