Please tell this beginning coder why this do loop runs infinitely. It's supposed to break out into the switch statement when the user enters a "y" but it keeps looping no matter what. Thanks
public static boolean YesNo (String query) {
Scanner localScanner = new Scanner(System.in); // Create a Scanner object
boolean temp = false;
String c = "Y";
do {
System.out.print(query);
c = localScanner.next();
c = c.toUpperCase();
} while (c != "Y"); //THIS DOESN'T WORK
switch (c) {
case "Y":
temp = true;
case "N":
temp = false;
}
return temp;
}