Tag: 浮点式

Java:d​​ouble vs float

在另一个Bruce Eckel练习中,我编写的代码采用了一种方法,并在另一个类中更改了值。 这是我的代码: class Big { float b; } public class PassObject { static void f(Letter y) { yc = ‘z’; } //end f() static void g(Big z) { zb = 2.2; } public static void main(String[] args ) { Big t = new Big(); tb = 5.6; System.out.println(“1: tb : ” + tb); g(x); […]

为什么Java中的数字除以零无穷大?

为什么要在Java中使用以下代码 System.out.println(new Integer(1)/ new Double(0)); 打印’无限’而不是未定义。 这不是数学错误吗?