If you want to handle different types of exceptions differently, have multiple
catch blocks. Kotlin will go top down through your catch blocks to find and invoke
the first whose parameter type matches the raised exception.
Here, since we are triggering a NullPointerException, our NullPointerException-specific
catch block gets called.
You can learn more about this in:
Tags: