Code that compiles may not run successfully. In that case, an exception will be thrown.
This code snippet attempts to get the length of a null string, which results
in a NullPointerException. We will see later how null works in Kotlin, as
there are quite a few differences from other languages like Java. But, in the
end, if you somehow manage to try accessing a property or calling a function
on null, it is likely to result in a NullPointerException.
You can learn more about this in:
Tags: