标签: java
很明显
int x = 3/4; // x is 0 here
但我不明白为什么以下情况也是如此:
double x = 3/4; // x is also 0 here
通过以下我能够得到我想要的结果:
double x = (double) 3/4; // x is 0.75 here, but why do i have to cast?