What difference between !! and ? in Kotlin, see below table.

a: String?a.lengtha?.lengtha!!.length
“cat”Compile-time error33
nullCompile-time errornullNullPointerException

 Ref: https://kotlinlang.org/docs/reference/null-safety.html

Leave a Reply

Your email address will not be published.Required fields are marked *