While loop does not function properly
Hi guys. I have a simple problem with my While loop but I was looking into it long time and I don't understand why loop goes over again all the time and never ends. As you see cont = "t", but later I enter "n" with keyboard, but loop still goes on. I even made this line: Code:
System.out.println(cont);
just to make sure how does cont looks like just before loop ends and it says that cont is "n", but the while loop never ends. Inputt is a method I made to enter strings but it works well.
Code:
String cont = "t";
while (cont != "n"){
System.out.println("Enter new part name:");
partName2 = inputt();
System.out.println("Do you want to enter aditional parts? y/n");
[B]System.out.println(cont);[/B] // cont is "t" here
cont = inputt();
[B]System.out.println(cont);[/B] // cont is "n" here if I enter "n".
}