• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exceptions

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
thanks
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic