This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exceptions" Watch "Exceptions" New topic
Author

Exceptions

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
There was this mock exam question:
to prevent code which follows a try block from being executed when an exception is caught,you can
a)code a return statement in catch clause
b)call System.exit() in catch clause
c)code a return statement in finally clause
d)code an end clause
e}none of the above.
when i tried an exception program,i found
a)here finally statement is executed but after that nothing is executed.
b)here finally statement is also not executed
c)this results in a compiler error that the statement after finally is unreachable.
d)i have no idea about this end clause.
i would like to know whether the question means none of the statements that follows try should be executed after an exception is caught including finally statement or only statements after finally???
can we include c) as an answer.
please help
thanks
 
wood burning stoves
 
subject: Exceptions