Why can I throw null in Java? [duplicate]
It looks like it’s not that null is treated as a NullPointerException, but that the act of attempting to throw null itself throws a NullPointerException. In other words, throw checks that its argument is nonnull, and if it is null, it throws a NullPointerException. JLS 14.18 specifies this behavior: If evaluation of the Expression completes … Read more