1. public static final int END = Integer.MAX_VALUE;
public static final int START = END - 10;
public static void main(String[] args)
{
int count = 0;
for (int i = START; i <= END; i++)
count++;
System.out.println(count);
}
i 会变成负的。
2.判断奇数用 =1 ,还是用 !=0 准确一点。 =1 只针对正整数。
3.int minutes = 0;
for (int ms = 0; ms < 60*60*1000; ms++)
if (ms % 60*1000 == 0)
minutes++;
System.out.println(minutes);
如果不注意运算符的优先级,结果就不是 想要的 60 而是 60000
4. public static boolean decision()
{
try
{
return true;
}
finally
{
return false;
}
}
会返回什么 true false 纠结 还是finally起作用。