• +91 9723535972
  • info@interviewmaterial.com

Kotlin Interview Questions and Answers

Question - What do you understand by the Kotlin double-bang (!!) operator?

Answer -

The Kotlin double-bang (!!) operator converts any value to a non-null type and throws a KotlinNullPointerException exception if the value is null. It is also called the not-null assertion operator.

Example:   
fun main(args: Array) {  
    var email: String?  
    email = null  
    println(email!!)  
}  
This operator should be used in cases where the developer is 100% sure that its value is not null.

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners