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)

}

Comments

Popular posts from this blog

Your build is currently configured to use incompatible Java 21.0.3 and Gradle 8.2.1. Cannot sync the project.

Google Assistant Implementation in Android application with app actions