Created
October 29, 2015 04:20
-
-
Save puffnfresh/5852cd41c30604342fa2 to your computer and use it in GitHub Desktop.
null.asInstanceOf[Int].asInstanceOf[String]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> null.asInstanceOf[Int] | |
res0: Int = 0 | |
scala> 0.asInstanceOf[String] | |
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String | |
... 33 elided | |
scala> null.asInstanceOf[Int].asInstanceOf[String] | |
res2: String = null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/a/10750800