此代码不起作用。我该怎么办?
public static void main(String[] args) {
String java = "java";
String p = javax.swing.JOptionPane.showInputDialog("Password lives:4");
if (p == java || java == p) {
javax.swing.JOptionPane.showMessageDialog(null, "You are correct");
System.exit(0);
}
String p1 = javax.swing.JOptionPane.showInputDialog("Password lives:3");
if (p1 == java || java == p1) {
javax.swing.JOptionPane.showMessageDialog(null, "You are correct");
System.exit(0);
}
String p2 = javax.swing.JOptionPane.showInputDialog("Password lives:2");
if (p2 == java || java == p2) {
javax.swing.JOptionPane.showMessageDialog(null, "You are correct");
System.exit(0);
}
String p3 = javax.swing.JOptionPane.showInputDialog("Password lives:1");
if (p3 == java || java == p3) {
javax.swing.JOptionPane.showMessageDialog(null, "You are correct");
System.exit(0);
}
javax.swing.JOptionPane.showMessageDialog(null, "You lose");
}