Comparing text with equals
Text is compared with equals, not with ==:
Scanner scanner = new Scanner(System.in);
String first = scanner.nextLine();
String second = scanner.nextLine();
System.out.println(first.equals(second));
System.out.println(first == second);
cat
cattrue
falseBoth lines are cat, yet == says false. For Strings, == doesn't check whether the texts are the same: it checks whether the two variables refer to the very same String object in memory. Every nextLine() that reads some text makes a new String, so two reads of the same word aren't ==. first.equals(second) compares the characters, which is what you want. Module 22 explains objects and references properly.
To compare with a fixed word, write the text in quotes: command.equals("quit"). Capitals count: "Quit".equals("quit") is false. equalsIgnoreCase ignores them.