so i have a program that takes the text from a jtextfeild on jbutton click and checks it against some posabilitys in a while loop
example:
while (true) {
if (i.equals("1") {
//do something
break;
}
else if (i.equals("2") {
//do something else
break;
}
}
but this doesn't work for some reason. it only works when i put a system.out.println(""); into the while loop.
example:
while (true) {
system.out.prinln("");
if (i.equals("1") {
//do something
break;
}
else if (i.equals("2") {
//do something else
break;
}
}
anyone know why this is happening or how to fix it?
i have it printing the value of i to console every time i hit the jbutton and it shows up as 1 or 2 so its not that
Aucun commentaire:
Enregistrer un commentaire