I am coming from Java, and trying to understand the following Scala syntax
null.asInstanceOf[Double]
Why is this not a NullPointerException?
I was trying to do something like:
var d : Double = 0
if(d == null)
// do something
However, I got following error message:
comparing values of types Double and Null using `==' will always yield false
This got fixed when I changed null to null.asInstanceOf[Double] as per this answer, but this is a weird statement for me, how on earth this is working?