我試圖擺脫一個循環,我只是想繼續輸入數字,直到我輸入0,這是我有,但我似乎無法打破它。打破循環
import javabook.*;
class loop {
public static void main (String [] args) {
MainWindow mWin = new MainWindow();
InputBox iBox = new InputBox(mWin);
int numbers = iBox.getInteger("");
while (numbers > 0) {
if (numbers > 0) {
iBox.getInteger("EnterNumber");
} else if (numbers == 0) {
break;
}
}
}
}
縮進你的程序正確,您應該看出錯誤。 – 2012-01-09 15:20:00
你從未將'數字'再次設置爲任何東西。 – 2012-01-09 15:20:07
'while'循環中沒有更新'numbers' – 2012-01-09 15:20:14