Java Exception propagation
Rule: By default Unchecked Exceptions are forwarded in calling chain (propagated).Program of Exception PropagationOutput:exception handled normal flow... In the above example exception occurs in m() method where it is not handled,so it is propagated to previous n() method where it is not handled, again it is propagated to p() method where exception is handled. Exception can be handled in any method in call stack either in main() method,p() method,n() method or m() method. Rule: By default, Checked Exceptions are not forwarded in calling chain (propagated).Program which describes that checked exceptions are not propagatedOutput:Compile Time Error Next TopicThrows Keyword
|