February 2019
Intermediate to advanced
442 pages
11h 46m
English
While working with Java, when the program executes and tries to access the variables set to null and then not initialized with a proper value, it will crash the system and produce the classic exception called NullPointerException.
As we know, Kotlin is a statically typed language so everything is defined as a type, including null values. The nullability is a type in Kotlin. By default, a Kotlin compiler does not allow a null value to any type. Generally, when we define variables, we set their values at the time of declaration.
But, in some exceptional cases, you don't want to initialize the variable at the time of declaration. In this case, while using those variables, the Kotlin compiler will raise the concern. For example: ...