• 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
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

try catch block

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In try catch block,We are handling Exception catch block,Why we cant catch Throwable?.Is there any reason?
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy!

you can catch any class extending Throwable and Throwable itself, shouldn't be a problem.



Yours,
Bu.
 
Author
Posts: 974
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The point may be that, even though you certainly can catch Throwable, you probably shouldn't.

There are two kinds of Throwables: Exceptions and Errors. Errors are usually things that are difficult to recover from, such as VirtualMachineErrors.

It's fine to catch Exceptions, but you usually don't want to catch Errors.

This is a general rule. As usual, there are rare times to deviate from it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!