I haven't used Java in a while and am having a simple yet frustrating error. My code is something like this:
public static void main(String[] args) throws IOException{
String input = "";
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(input != "Q"){
input = in.readLine().toUpperCase();
switch(input){
default: break;
case "A": //do stuff break;
case "B": //do stuff break;
}
}
System.out.println("Out of the loop!"); //never reaches this statement
}
I ran the eclipse debugger and it clearly shows the input variable being changed to "Q" when entered by the user, but the while loop keeps restarting.