What is the basic difference between the 2 approaches to exception handling.
1> try catch block and
2> specifying the candidate exceptions in the throws clause?
When should you use which approach?
Pinned topic What is the basic difference between the 2 approaches to exception handling
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2007-11-16T11:34:26Z at 2007-11-16T11:34:26Z by SystemAdmin
SystemAdmin 110000D4XK1240 Posts
Re: What is the basic difference between the 2 approaches to exception hand2007-11-16T11:34:26ZThis is the accepted answer. This is the accepted answer.Well, the basic difference is who is going to handle the exception, the caller or you?
If you declare that your method is throwing exception then you are passing the
responsibility of handling that exception to the caller, and he will decide how to handle it.
If you decide to catch an exception using try & catch , then you are handling the exception
on the spot and the exception would not propagate further in the calling stack.