• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Rule Round-Up question 68

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(#68) If an exception is not caught, the finally block will run and the rest of the message is skipped.

Answer given is true. Well yes but hate to pick but this question does not say an exception is thrown just that its not caught.

If the exception is never thrown then finally will still be called.. but the rest of the message will not be skipped.
 
lowercase baba
Posts: 12799
51
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, i didn't write the questions, or have anything to do with the roundup.

i interpret the question as "if there is an exeption that is not caught".
 
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exact text of question #68 is:
"if an exception is not caught, the finally block will run and the rest of the method is skipped."
I was wondering what sort of message was being skipped when I read the version of the question above.

Perhaps it is not clear that "if an exception is not caught" means "if there is an exception thrown which is not caught" rather than "if no exception is caught(possibly because none was thrown)". In the former case - if an exception is thrown and not caught - then the only thing in the method that will still execute is the finally clause.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Marilyn de Queiroz:
In the former case - if an exception is thrown and not caught - then the only thing in the method that will still execute is the finally clause.



Well, while we are in nitpicking mode, it's actually "finally clause(s)" - it could be more than one, in the case of nested try blocks.
 
Legend has it that if you rub the right tiny ad, a genie comes out.
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!