Results 1 to 2 of 2
  1. #1
    herat is offline Member
    Join Date
    Jun 2011
    Rep Power

    Default Exception handling

    What is better,To write single Exception class in catch block or to write specified Exception in
    multiple catch blocks...???
    Please help me out as soon as possible...

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power


    I tend to use mutiple catch blocks deeper in the code when developing since I might need to handle them differently as I'm writing the thing.
    Higher up the chain I wold tend to move towards more generic catches.
    I also try and construct a reasonable exception hierarchy, so I have a generic exception from which my more specific ones are children.
    Try and avoid catch (Exception e), except when trying to prevent the user from being presented with a crash.

Similar Threads

  1. Exception Handling
    By link6790 in forum New To Java
    Replies: 16
    Last Post: 05-19-2011, 06:57 PM
  2. Exception Handling
    By eLancaster in forum New To Java
    Replies: 4
    Last Post: 02-20-2011, 01:00 AM
  3. Exception Handling
    By liljester in forum New To Java
    Replies: 4
    Last Post: 06-21-2010, 03:09 PM
  4. Exception Handling help
    By MZA in forum New To Java
    Replies: 3
    Last Post: 02-10-2010, 10:23 AM
  5. Exception Handling...
    By focus_nitin in forum New To Java
    Replies: 1
    Last Post: 02-16-2008, 04:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts