String quit="N";
int i=0;
ArrayList<String> course = new ArrayList<String> ();
Scanner scan = new Scanner(System.in);
while (quit!="y")
{
System.out.println("Enter the Course code or y to exit:");
quit=scan.next();
System.out.println(quit);
};
System.out.println("out");
}
Im trying to quit the loop if the input is "y", but however the while loop continues execution over and over even after the input is "y", please help.