非常感谢大家的帮助!我想通了,让它运行起来,我想我喜欢让事情变得比实际更困难。
import javax.swing.JOptionPane;
public class PasswordManager{
private static String masterPassword = "secret3";
public static void main(String[] args){
boolean mypass = false;
String password = JOptionPane.showInputDialog(null, "Enter Password:");
mypass = checkPassword(password);
if (mypass == true)
System.out.println("Your Password is Correct");
else
System.out.println("Your Password is incorrect");
}
private static boolean checkPassword(String password){
if(password.equalsIgnoreCase(masterPassword))
return true;
else
return false;
}
}