Null Safety

 

In Kotlin working with nulls is safe. Kotlin's type system protects us from getting null pointer exceptions.

 

To get null pointer exception you must do one of the following:

 

- Explicitly throw NullPointerException

- Use !! operator (see examples we provided in this book)

- Use Java code that is not guarded against it

- Inconsistence with initialization