<分区>
public class Test {
public static void main(String [] s) {
int x = 99999;
long y = 99999;
long res = x * x;
System.out.println("x^2 = " + res);
res = y * y;
System.out.println("y^2 = " + res);
}
}
Output:
x^2 = 1409865409
y^2 = 9999800001
看到上面代码段的输出,我真的很困惑。我希望得到相同(正确)的答案,但这里 x^2 实际上是错误的!