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.
About Question com.enthuware.ets.scjp.v6.2.380 :
Moderator: admin
-
- Posts: 4
- Joined: Sun Oct 26, 2014 6:33 am
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.380 :
Because NullPointerException is a RuntimeException. RuntimeExceptions don't need to be declared in the throws clause.
-
- Posts: 3
- Joined: Sat Feb 27, 2016 1:55 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.380 :
Why the answer for no. 1 is AssertionError() and not the IllegalArgumentException()?
Who is online
Users browsing this forum: No registered users and 35 guests