import java.util.Scanner;
public class LoginPage{
public static void main (String[]args){
System.out.println("______________");
System.out.println("| Login Page |");
System.out.println("______________");
System.out.println();
//Declare Strings
String Log;
String Pass;
String TestU = "Corey";
String TestP = "Chicken";
int i = 0;
//Declare Scanner
Scanner scan = new Scanner (System.in);
while(i<=6){
System.out.print("Username: ");
Log = scan.nextLine();
System.out.print("Password: ");
Pass = scan.nextLine();
i++;
if((Log==TestU)&&(Pass==TestP))
{break;}
}
}
}
This is the current code for a login page i'm trying to create. The 'TestU' and 'TestP' are just there instead of usernames/password that i will read from a data file. But when i enter in 'Corey' and 'Chicken' it doesn't exit the while loop. I might just be doing something very simple wrong but i cannot find it and i cannot find it on google or anything(Maybe i'm searching the wrong problem.) But any help would be greatly appreciated.