Thi*_*ndu 1 java floating-point double
在下面的代码中,我们构建了一些Double来自变量double,float和String.但是,根据文档,Double只有构造函数接受double和String- 而不是float.那么这段代码是如何编译的呢?
Double d1 = new Double(2.5);
Double d2 = new Double(2.5f); //Why can I pass a float here?
Double d3 = new Double("2.5");
Run Code Online (Sandbox Code Playgroud)