• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

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: 12773
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.
 
I am going to test your electrical conductivity with this tiny ad:
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!