Many developers quickly learn about the challenges associated with handling null types in a programming language. One of the most common errors for Java developers is NullPointerException, which is caused by trying to access an object that is null. In fact, the frustrations attributed to null are so great, it's even been referred to as the "billion-dollar mistake."
Seeing, and understanding, the problems that null has caused in Java and other languages, Kotlin was designed to eliminate null as much as possible. In Kotlin, types are non-null by default. To work with a nullable type requires the explicit addition of the ? symbol. In this section, we'll look at how to define null and non-null types, and a few of the ways we can handle nullable types within our Kotlin code.