• 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
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Unchecked & Checked Exceptions

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What i understand that if it is unchecked exceptions, we dodn't have to use catch otherwise we have to use.
Generally first we are using throw then catch then try & Finally.
May I correct? Pleae confirm!
Thanks in advance
Anuja
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
unchecked exceptions are runtime exceptions
ie arithmetic ,nullpointer ,number format
for the above mentioned exceptions we need
catch stmt or finally stmt
 
Anuja
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi bala_chocos
Thanks a lot!
So for unchecked exceptions, we have to use either catch or finally and for checked, we don't have to use catch
right!
thanks in advance,
anuja

Originally posted by Anuja:
What i understand that if it is unchecked exceptions, we dodn't have to use catch otherwise we have to use.
Generally first we are using throw then catch then try & Finally.
May I correct? Pleae confirm!
Thanks in advance
Anuja


 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anuja,
You have got it wrong.
Unchecked(RuntimeException and its subclasses) exceptions need not be caught(try/catch) or declared in the 'throws' clause of the method.You need to do this only for Checked(Exception and its subclasses,excluding RuntimeException and its subclasses)exceptions.I would advice you to go through the Chapter on 'Exceptions' in the Java language specification.(freely downloadable from java.sun.com)
 
Anuja
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi JavaMan
Thanks a bunch!!!
Regards,
anuja

Originally posted by Anuja:
What i understand that if it is unchecked exceptions, we dodn't have to use catch otherwise we have to use.
Generally first we are using throw then catch then try & Finally.
May I correct? Pleae confirm!
Thanks in advance
Anuja


 
What's that smell? I think this tiny ad may have stepped in something.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic