title: Try-catch-finally order of execution appears to be random
body: <p>I am trying to understand how the <code>try-catch-finally</code> execution flow works. There are a couple of solutions from Stack Overflow users regarding their execution flow.</p>
  
  <p>One such example is:   </p>
  
  <blockquote>
  <pre><code>try {
      // ... some code: A
  } 
  catch(...) {
      // ... exception code: B
  } 
  finally {
      // finally code: C
  }
  </code></pre>
    
    <p>Code A is going to be executed. If all goes well (i.e. no exceptions get thrown while A is executing), it is going to go to <code>finally</code>, so code C is going to be executed. If an exception is thrown while A is executed, then it will go to B and then finally to C.</p>
  </blockquote>
  
  <p>However, I got different execution flows when I tried it:</p>
  
  <pre><code>try {
      int a=4;
      int b=0;
      int c=a/b;
  }
  catch (Exception ex)
  {
      ex.printStackTrace();
  }
  finally {
      System.out.println("common");
  }
  </code></pre>
  
  <p>I am getting two different outputs:</p>
  
  <p><strong>First output:</strong></p>
  
  <pre><code>java.lang.ArithmeticException: / by zero
  at substrings.main(substrings.java:15)
  lication.AppMain.main(AppMain.java:140)
  common
  </code></pre>
  
  <p>However, when I ran the same program for the second time:</p>
  
  <p><strong>Second output:</strong></p>
  
  <pre><code> common
      java.lang.ArithmeticException: / by zero
      at substrings.main(substrings.java:15)
  </code></pre>
  
  <p>What should I conclude from this? Is it going to be random?</p>