Type cast operator "as" in kotlin
fun main(args: Array<String>) {
/* Type casting in kotlin
unsafe vs safe cast operator
as - as?
*/
val obj: Any? = null
val name: String? = obj as? String
println(name)
}
fun main(args: Array<String>) {
/* Type casting in kotlin
unsafe vs safe cast operator
as - as?
*/
val obj: Any? = null
val name: String? = obj as? String
println(name)
}
Comments
Post a Comment