I want to initialize a variable of type Int
as null
in Scala but I am not able to do so -
scala> val a: Int = null
<console>:11: error: an expression of type Null is ineligible for implicit conversion
val a: Int = null
But I can initialize a variable of type String
as null
in Scala:
scala> val a: String = null
a: String = null
Anyone know the reason for it?
Note - I am using Scala 2.11.8