Possible Duplicate:
What is the advantage of using try {} catch {} versus if {} else {}
I’d like to know whether, generally speaking, it’s better to use a try/catch construct or to try to prevent this exception by (excessive?) use of if/else. Example: should I catch a FileNotFoundException, or should I test and try to find the file first.
What would be the best approach?
They are totally different. They are not interchangeable, and which is appropriate is determined by the requirement and context.
EDIT: This answer is based on the original, unedited question. The original, in it’s entirety was: