


And this external Java Code is not NullPointerException proof, unless you make it so.įollowing are some of the ways to handle Null Safety in Kotlin. You may be aware that you can run external Java code in your application.This operator comes with a disclaimer for usage : You have been warned! And yet you chose to live with NullPointerException. When you ask for a NullPointerException explicitly.Of course there are ways you might give NullPointerException a chance to live one more Exception again. Kotlin could never throw a NullPointerException unless you ask for it. Kotlin is so concerned about this, and made its type system in such a way that it eliminates the usage of NullPointerException, unless you want it explicitly. NullPointerException is so popular as NPE ( Null Pointer Exception), since it costed billions of dollars to companies. If you are a Java developer, you might have definitely come across the atrocities of NullPointerException it creates during real time. Null Safety in Kotlin is to eliminate the risk of occurrence of NullPointerException in real time.
