Page 1 of 1

About Question com.enthuware.ets.scjp.v6.2.380 :

Posted: Tue Oct 28, 2014 7:37 am
by milskruger
Why are there no need for throws?
I was under the impression that adding throws to the method(The method that does not want to handle the exception) allows the exception to propagate down the stack.

Re: About Question com.enthuware.ets.scjp.v6.2.380 :

Posted: Tue Oct 28, 2014 8:40 pm
by admin
Because NullPointerException is a RuntimeException. RuntimeExceptions don't need to be declared in the throws clause.

Re: About Question com.enthuware.ets.scjp.v6.2.380 :

Posted: Thu Jul 14, 2016 5:19 pm
by msalam4
Why the answer for no. 1 is AssertionError() and not the IllegalArgumentException()?