0

my output for this code doesn't function well. When I'll enter the output from the command prompt, the String userName can't read from my code. When I press 1 in try again, the userName tag can't function to write anything. This is my whole code about this problem.

import java.util.Scanner;
import java.util.Arrays;
public class LoopLogin {
    public static void main(String[] args) {
    String[] ArrayUserName;
    Scanner input = new Scanner (System.in);
        while (true) {
            System.out.println("--------------------------");
            System.out.print("Username: ");
            String userName = input.nextLine();
            System.out.println("--------------------------");
            ArrayUserName = new String[]{"bleachOFFICIAL", "iiRJ02iii"};
                if (Arrays.asList(ArrayUserName).contains(userName)) {
                    System.out.println("Welcome, " + userName);
                    break;
                } else {
                    System.out.println("Account not found\n");
                    System.out.println("[1] Try again.");
                    System.out.println("[2] EXIT");
                    System.out.print("Enter item code number: ");
                    int choice = input.nextInt();
                        if (choice == 1) {
                            continue;
                        } else {
                            System.exit(0);
                        }
                }
        }
    }
}

here is the output from the command promptWhen I want to retry, this happened.

blitz kek
  • 11
  • 1

0 Answers0