import java.util.Scanner;
public class Password {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.println("Please create a password");
String pw = reader.nextLine();
while (true) {
System.out.println("Enter the password");
String pwt = reader.nextLine();
if (pwt == pw) {
System.out.println("The password is correct!");
break;
} else {
System.out.println("The password is incorrect, please try again");
}
}
}
}
我对此不熟悉,所以答案可能很明显,但当我输入正确的密码时,我只是不明白为什么它会显示为错误