-1
我有一個運行無限while循環的java應用程序。當我點擊eclipse上的運行時,它似乎正在恢復到我已更改的舊代碼。事情是,當我隨機構建更新時。最近一次我添加System.exit()。我改變了代碼,它仍然退出。我也在C#中試過這個程序。我覺得我在某種程度上將語言運行時與無限while循環混淆了。該程序適用於一系列不斷變化的布爾值。我看到的反常行爲(這是我添加System.exit()之前發生的事情)的主要操作是在迭代BufferedImage中的像素的方法中。我正在運行Ubuntu 14.10。我試圖製作一個新項目並粘貼相同的代碼(它可能是不可見的字符?)我很困惑,如果有人可以幫助,我會很高興。Java編譯錯誤的舊文件
while(true){
if (bool1 && !exe.isSeparate(image))
{
// change boolean values
// did run System.exit(0)
}
if (bool2 && !exe.isSeparate(image))
{
// change boolean values
// did run System.exit(0)
}
}
boolean isSeparate(BufferedImage image)
{
int x = touchingX;
boolean first = false, second = false, third = false;
int startAt = this.getYStart(image);
for (int y = startAt; y < startAt + 150; y++)
{
Color pixel = new Color(image.getRGB(x, y));
if (!(pixel.getRed() == 255 && pixel.getGreen() == 255 && pixel.getBlue() == 255)
&& !(pixel.getRed() == 0 && pixel.getGreen() == 68 && pixel.getBlue() == 125))
{
if (!first)
{
first = true;
}
if (first && second && !third)
{
third = true;
}
}
else
{
if (first && !second)
{
second = true;
}
}
}
if (first && second && third)
{
return true;
}
return false;
}