Here's my code. My problem is that I'm trying to check if my user input variable, titleScanner, is equal to the title (which is specified earlier in the code) or if its equal to "exit". Even when I get my code to print out what titleScanner is equal to (exit when I type exit) the else if code for exit won't run.
void getId() {
Scanner titleScanner = new Scanner(System.in);
System.out.println("Please enter the title of the game in order to obtain the ID Number");
int loopbreak = 0;
while (loopbreak == 0) {
String titleVerification = titleScanner.nextLine();
if (titleVerification == title) {
System.out.println(title + " has ID Number " + id);
loopbreak = 1;
} else if (titleVerification == "exit") {
loopbreak = 1;
} else {
System.out.println("Please enter a valid title or type exit to exit");
}
}
}