I have this java code and I tried to check by system output the variables if it's all good and I don't get out of while loop, why? I insert alex as username and mihai as password and I don't get out of while loop. And I think it is really strange cuz everything is ok right?
boolean isGoodUandP = false;
String username = "";
String password = "";
while (isGoodUandP == false) {
System.out.print("Please enter username: ");
Scanner sUsername = new Scanner(System.in);
username = sUsername.nextLine();
System.out.println("username este " + username);
System.out.print("Please enter password: ");
Scanner sPassword = new Scanner(System.in);
password = sPassword.nextLine();
System.out.println("parola este " + password);
if ((username == "alex") && (password == "mihai")) {
isGoodUandP = true;
System.out.println("Bine ati venit!");
}
}