Sometimes I face I must write a piece of code like this (usually it have more nested if and more complex structure but for the example is enought)
public voi
A code should never include exception handlers for unchecked exceptions. A null check should always be used for an object reference which has a chance of being null.