• 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
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Help me in Exception Handling

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
In handling exceptions it is possible to catch any exception using a catch block which has Exception object as parameter.Plz explain how it is achieved?
with regards,
Manoj
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Since Exception is the Topmost class extended after Throwable and since all other exceptions thrown by the try catch block are comming as a subclass of Exception class, it is possible to catch all the exceptions by Exception object in the catch block.

------------------
SeE Consulting(P) Ltd
Bangalore,India
 
Manoj Chandran
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi aruna,
I read your reply.I'm not satisfied as i already know the things u wrote.I want to get deep information in this matter.Hope u can help me..
thanking u,
Manoj
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Manoj,
You can catch Exception

The above will catch any exception which subclasses Exception; however, this is not a recommended technique. If you're looking for an IOException or FileNotFoundException then your catch should look for that specifically ... makes things easier for anyone else using your code.
Hope that helps.
------------------
Jane Griscti
Sun Certified Java 2 Programmer
"When ideas fail, words come in very handy" -- Goethe
 
reply
    Bookmark Topic Watch Topic
  • New Topic