Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

try catch block  RSS feed

 
Chris Cleverley
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say there is a try block in which an exception is thrown. But the only exception that can be caught is one that is a parent of the exception that is actually thrown.
Will this exception be caught ?
Chris
 
KN
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Whenever you have a catch block which handles a particular exception, then all the exceptions which are the subclasses of that particular Exception are also caught with the same block.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!