This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exceptions" Watch "Exceptions" New topic


Arathi Rajashekar
Ranch Hand

Joined: Nov 20, 2001
Posts: 112

1 Since the method foo()does not the catch the exception thrown by the method baz(), it must declare runtime exception in its throw clause
2 A try block cannnot be followed both by catch and finally block
3 An empty catch block is not allowed
4 A catch block cannot follow finally block
5 A finally block should always follow one or more catch block
I feel all the option is wrong.Answer a is wrong because finally block cannot come before catch block. Any other suggestion
Thanks in advance

Arathi<br />Sun Certified Java Programmer
Arathi Rajashekar
Ranch Hand

Joined: Nov 20, 2001
Posts: 112
I got the answer. Answer is 4.
I read the answers properly
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
What if u remove catch after finally & baz() within finally.And put bar() in finally.

Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining
Seany Iris
Ranch Hand

Joined: Jan 08, 2002
Posts: 54
yes,the answer is 4.
if you try to compile the code,it will give you: 'catch' without 'try'
catch (MyException e)
I think that an catch must come on the heels of try if it is needed.

help you means help me
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
ans should be 4. i agree.
I agree. Here's the link:
subject: Exceptions
jQuery in Action, 3rd edition