私は次のコードを書きました。これは、ステートメントを印刷する場合としない場合で答えが異なります。
class test
{
public static void main(String args[])
{
int i = Integer.MAX_VALUE;
int j = Integer.MAX_VALUE-100;
int count = 0;
for(; j<=i; j++){
count++;
//System.out.println(j); // If we remove comment, answer is different
}
System.out.println(count + ", " + j + ", " + (j<=i));
}
}
印刷ステートメントなしの答えは次のとおりです。
101, -2147483648, true
そしてprintステートメントは:
15588, -2147468161, true
どちらの場合も、最終条件はを返す必要false
がありますが、を返しますtrue
。誰でもこれを説明できますか。