title: Passing an exception up the calling chain
body: <p>Was hoping for an explanation as to what it means to pass an exception up the calling chain by declaring the exception in my methods throws clause and why I would want to do that.</p>
  
  <p>Here is an example of my understanding of throwing own exception.</p>
  
  <pre><code>public class ExceptionThrow {
      char[] charArray = new char[] { 'c', 'e', 'a', 'd' };
  
      void checkArray() throws ABException {
          for (int i = 0; i &lt; charArray.length; i++) {
              switch (charArray[i]) {
              case 'a':
                  throw new ABException();
              case 'b':
                  throw new ABException();// creating the instance of the
                                          // exception anticipated
              default:
                  System.out.println(charArray[i] + " is not A or a B");
  
              }
          }
      }
  
      public static void main(String[] args) {
          ExceptionThrow et = new ExceptionThrow();
  
          try {
              et.checkArray();
          } catch (ABException ab) {
              System.out.println(ab.getMessage() + " An exception did actually occur");
          } finally {
              System.out.println("This block will always execute");
          }
  
      }
  }
  
  class ABException extends Exception {
  }
  </code></pre>
  
  <p>How would I pass the exception 'up the calling chain'?</p>
  
  <p>regards
  Arian</p>