掉了大括号!
if (m==123)
{ JOptionPane.showMessageDialog(
null,
"您输入的密码是:123"),
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}/////////////
if (n==0)
{ JOptionPane.showMessageDialog(
null,
"您输入的密码都不正确,请确认后再执行程序!");
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}//////
}
}
if (m==123)
{ JOptionPane.showMessageDialog(
null,
"您输入的密码是:123"),
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}/////////////
if (n==0)
{ JOptionPane.showMessageDialog(
null,
"您输入的密码都不正确,请确认后再执行程序!");
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}//////
}
}
JOptionPane.PLAIN_MESSAGE); "您输入的密码都不正确,请确认后再执行程序!");
这两处的后面是逗号,不是分号!
/////////
if (n==0)
{ JOptionPane.showMessageDialog(
null,
"您输入的密码都不正确,请确认后再执行程序!"),
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}//////
2、Integer.parseInt(String str);
3、JOptionPane.showMessageDialog中参数不够,且在参数中多了括号,分号之类
4、缺少大括号
import java.lang.String;
public class key {
public static void main(String args[]) {
int i = 3;
int m,n;
do {
String x = JOptionPane.showInputDialog("please input the key:");
m = Integer.parseInt(x);
i = i - 1;
n = i;
if (m != 123 && n != 0) {
JOptionPane.showMessageDialog( null,
"the key is wrong, please reinput:"+"\n you have " + n + " times!",
"input",
JOptionPane.WARNING_MESSAGE);
}
} while (m != 123 && n != 0); if (m == 123) {
JOptionPane.showMessageDialog( null,
"you input is right!",
"ok",
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
} if (n == 0) {
JOptionPane.showMessageDialog( null,
"sorry, you input is wrong!",
"error",
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
}