0

I am writing a program at work for writing a list of names and their devices. I have it to where the program will create the User class from the sheet, however now I am trying to write a loop that will wait for an indefinite amount of lookup requests. When debugging, I found that the program will repeat the input that I type, but it will not look through the array for a matching name. What is missing or wrong in this code snippet?

    Scanner userin = new Scanner(System.in);
    String in;
    String name;
    
    while(userin.hasNextLine()) {
        in = userin.next();
            for(int i = 0; i < users.length; i++) {
                name = users[i].name;
                if(name == in) {
                    System.out.println("found");
                }
            }
    }

I have tried using Arrays.asList(users).contains(in) but I get the same result. No search but the program will repeat my input which confirms that my input has been taken. Any ideas? Thanks!

Harl23
  • 17
  • 2

0 Answers0