Say bye bye to the NullPointerException

One of the major pain points with using Java and a number of other languages has to do with accessing a null reference. This can result in your application crashing without showing the user an adequate error message. If you're a Java developer, I'm pretty sure you're well acquainted with the almighty NullPointerExceptionOne of the most amazing things about Kotlin is null safety. 

With Kotlin, a NullPointerException can only be caused by one of the following:

  • An external Java code
  • An explicit call to throw the NullPointerException
  • Usage of the !! operator (we'll learn more about this operator later)
  • Data inconsistency regarding initialization

How cool is that?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset