Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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

rules roundup-ERROR

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(#132)TRUE or FALSE:if an exception is not caught,the finally block will run and the rest of the method is skipped.
Answer:TRUE
The finally block will always run if an exception is thrown,and then the exception is immediately passed to the calling method.
*****************************************************
I found the above question in the Rules Roundup Game(the answer given in the review section is also attached).
The answer says TRUE.But i strongly believe that the answer must be FALSE.Irrespective of whether an Exception is caught or not,the code in the Finally block is executed and the rest of the method is not skipped.
Any Exceptions??
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(#132)TRUE or FALSE:if an exception is not caught,the finally block will run and the rest of the method is skipped. - TRUE.
The question does not say "only when it is not caught".
There is a difference.
As far as this question is concerned, it is TRUE.
May be the following question's answer is FALSE.
TRUE or FALSE: The finally block will run and the rest of the method is skipped only when an exception is not caught

[This message has been edited by Alagu Seenivasan (edited October 05, 2000).]
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Irshad,
The answer is TRUE. Just because the finally block runs if an exception is not caught doesn't mean that the finally block doesn't if an exception *is* caught, right?
It's like saying if A then B implies if B then A. You know it's not always true
Cheers
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi irshad,
the term "Rest of the method" in the question implies the code that is after the try - catch -finally block. It does not refer to the finally block it self, because the question itself says that the finally block is getting executed.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friend,
>Irrespective of whether an Exception is caught or not,the code >in the Finally block is executed and the rest of the method is >not(?!) skipped.
an exception is caught or not really does matter:
If no catch clause handling an exception can be found, then the current thread (the thread that encountered the exception) is terminated, but only after all finally clauses have been executed and the method uncaughtException has been invoked for the ThreadGroup that is the parent of the current thread - the rest of the metod is skipped !
If the exception has been dealt with in a catch block, normal exectution resumes - the rest of the method get run!
hope this will help
rong chen
 
irshad husain
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that was great guys,
Thanks
 
I RELEASE YOU! (for now .... ) Feel free to peruse 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!