Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ambiguous "finally" question

 
Rick O'Shay
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q. If an exception is not caught finally is run and the rest of the method is skipped.

There are two interpretations of "not caught" so I would rephrase this as "If an exception is thrown and not caught" just to be clear. The other interpretation of "not caught" is not supplying a catch clause.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed.

Was this from a particular mock exam somewhere?
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't finally always run, even if an exception is not thrown? This makes the question even less clear IMHO.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic