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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
milskruger
Posts: 4
Joined: Sun Oct 26, 2014 6:33 am
Contact:

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

Post 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.

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Because NullPointerException is a RuntimeException. RuntimeExceptions don't need to be declared in the throws clause.

msalam4
Posts: 3
Joined: Sat Feb 27, 2016 1:55 pm
Contact:

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

Post by msalam4 »

Why the answer for no. 1 is AssertionError() and not the IllegalArgumentException()?

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests