I have a question for which I myself have a very intuitive answer. This question relates to the try-catch-finally blocks in Java. Well just the other day I was trying out something and I bumped into this compilation error. I have also gone through Do you really need the 'finally' block which answers lot of my doubts(especially comment #2).
What I am looking for here is why do I see a compilation error when I comment lines from #11 to #13(basically I am commenting the inner catch block). And the compilation and run-time execution runs fine when uncomment the same lines. If I could get an answer more from a OOPS context, it would increase my knowledge & will be of great help.
Thanks in advance. !!
public class TryCatchFinally {
  public static void main(String[] args) throws Exception {
    try {
        System.out.println("Try...");
        throw new Exception();          
    } catch (Exception e) {
        System.out.println("Catch...");
        try {
            System.out.println("Inner Try");
            throw new Exception();
        } /*catch(Exception e1) {//Line #11
            System.out.println("Inner catch");
        }*///Line #13
        finally{
            System.out.println("Inner finally");
        }
        System.out.println("Going out of catch..");//Line #17
    }
    finally{
        System.out.println("Finally");
    }
    System.out.println("Going out of try..");//Line #22
}}
 
     
     
    