class TestSampl {
public static void main(String[] args) {
int a = -47, b = 47;
double c = -333.0, d = 333.0;
//why does integer print output as
System.out.println("Integer " + a/b + " " + a%b );
// and double print output as -0
System.out.println("Double " + c/d + " " + c%d );
}
}
答案 0 :(得分:2)
您对整数模数还是双模数感到困惑?
没有-0
整数,因此选择0
的选项很少。然而,双打有正负零(更不用说正无穷大,负无穷大和NaN
),所以对于双打,答案将是"因为它是如何定义的和" #34;