所以我正在开发一个 Java 项目,我输入以下内容:
double totalPages;
int amountKits = 2;
totalPages = amountKits / 3;
System.out.println("Total pages before ceil: " + totalPages);
totalPages = Math.ceil(totalPages);
System.out.println("Amount of Kits: " + amountKits);
System.out.println("Total Pages: " + totalPages);
结果如下:
Total pages before ceil: 0.0
Amount of Kits: 2
Total Pages: 0.0
有谁知道为什么会这样?(对不起,我是菜鸟,我知道)