• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Creating new exception types - slight confusion

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When creating a new exception type, should you extend java.lang.Throwable or java.lang.Exception.
The book I am using to study for my 1.4 cert states you should extend Exception, but then contradicts itself a few pages later.
Its not a massive issue you'll agree, but possibly one of these niggly things that could easily bite you on the ass in the exam.
Thanks.
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
If we say "When creating a new exception..." then I would say extend Exception as Throwable is more generic encompasing java.lang.Error as well which is different than "Exception"...
Regards
Maulin
 
Neil Mac
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, is it not an error (at compile or runtime) to extend Throwable as opposed to Exception ? I.e. the only difference will be that an exception which extends java.lang.Exception will be 'checked'.
The book was a little ambigous about this.
Thanks for your reply.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic