Have almost got this login system in Java to work, but am having trouble with this method:
public void Register() {
Scanner sc = new Scanner(System.in);
System.out.print("Register? (Y/ N)\n");
String N = sc.nextLine();
if ("N".equals(N)) {
Login();
} else {
String Y = sc.nextLine();
if ("Y".equals(Y)) {
System.out.print("Email address: ");
String string = sc.nextLine();
System.out.print("Password: ");
String string2 = sc.nextLine();
System.out.print("\n\n");
new Products().search();
}
}
}
Entering "N" works perfectly in the if section, but "Y" needs to be entered twice before the else section works (I understand why it doesn't work).
Its something simple I know, but any clue as to how to get it to work?
Appreciate any help...
inputFromUser. Just N N N.