This was the question asked in an interview. NullPointerException is very common; why is it not declared as a checked exception? I googled but did not get a proper answer.
This was the question asked in an interview. NullPointerException is very common; why is
Share
Almost every method would have to declare throwing it.
(As a sidenote – Eclipse for example gives you a warning whenever there is a “potential null pointer access” so that you can prevent the exception as early as possible.)