Why wrapping a generic method call with Option defers ClassCastException?

后端 未结 0 577
野趣味
野趣味 2020-12-18 20:33

Lets say I have an array like this*:

val foo: Any = 1 : Int
Option(foo.asInstanceOf[String])

which fails for obvious reason:



        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题