【发布时间】:2019-12-12 04:36:43
【问题描述】:
为什么下面代码的输出是 1345094336 而不是 39999800000?我应该如何编辑它?我相信这与整数溢出有关。
public class testC {
public static void main(String[] args) {
long product = 199999 * 200000;
System.out.println(product);
}
}
【问题讨论】:
-
尝试
long product = 199999 * 200000L;否则它正在使用 int 值相乘
标签: java