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...
Printable View
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...
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.