• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exceptions  RSS feed

Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!