It's not a secret anymore!
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exceptions" Watch "Exceptions" New topic


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
I agree. Here's the link:
subject: Exceptions
It's not a secret anymore!