I have tried inputing the same int as the validPin variable, but it makes infinite loop even though the condition is already true. Also, I have tried to change validPin to 12345 and it worked, but if the validPin is 002200 it doesnt work. Why?
public void main() {
Scanner in = new Scanner(System.in);
int validPin = 002200;
System.out.print("Enter PIN to access:");
int pin = in.nextInt();
while (pin != validPin) {
System.out.print("Invalid PIN, Try again:");
pin = in.nextInt();
}
System.out.println("You have entered the correct PIN, now you have acces for your account!");
}
}