Wrong type in Java conditional assignment

前端 未结 2 1882
再見小時候
再見小時候 2020-12-30 02:38

In the following code I have two identical conditional assignment operations, one returns an object of type Double, and the second returns the String \"Integer\".

         


        
2条回答
  •  醉酒成梦
    2020-12-30 02:48

    Well 0.0 is still == to 0

    System.out.println(0 == 0.0); // equals true
    

    http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.25

提交回复
热议问题