• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

doubt in Exceptions

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
How can we know whether it is checked Exception or uncheckedException like ClassNotFound,SQLExceptin, etc.

Thanks in advance.
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

All exceptions that are subclasses of RuntimeException are UNCHECKED, which means they are not being checked by the compiler whether you have followed the handle-or-declare rule.

All exceptions that are subclass of Exception but not of RuntimeException are checked exceptions (meaning, they are being checked by the compiler whether you have followed the handle-or-declare rule.)

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

All exceptions that are subclasses of RuntimeException are UNCHECKED, which means they are not being checked by the compiler whether you have followed the handle-or-declare rule.

All exceptions that are subclass of Exception but not of RuntimeException are checked exceptions (meaning, they are being checked by the compiler whether you have followed the handle-or-declare rule.)



To add to what said by Jart,

Error and it's sub-classes are also not checked by compiler.

Throwable and its sub-classes are checked by compiler

Murali...
SCJP5
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic