title: try/catch not working for static member throwable class?
body: <p>I am having some issues with throwing static member classes, as the title suggests. But I'm not sure if that's the problem, and the compiler gives me mixed signals as to what I should be doing! My program's classes and functions are all in a single file.</p>
  
  <p>Here's the definition of one of my Throwables (the others are essentially the same):</p>
  
  <pre><code>private static class ParenthesisException extends Throwable
  {
      public ParenthesisException(){}
      public String strErrMsg()
      {
          return "ERROR: Every '(' needs a matching ')'";
      }
  }
  </code></pre>
  
  <p>I'm throwing this in a member function that gets called by <code>main</code> inside a try/catch, statement. I throw my other <code>Throwable</code> class inside a function being called by said function being called by <code>main</code> in the try/catch statement. Here's a little segment of it:</p>
  
  <pre><code>try
  {
      parseFormula(cin.nextLine());
  }
  catch(ParenthesisException e)
  {
      System.out.println(e.strErrMsg());
  }
  catch(OperatorException e)
  {
      System.out.println(e.strErrMsg());
  }
  </code></pre>
  
  <p>parseFormula is the static member function throwing <code>ParenthesisException</code>.</p>
  
  <p>The compiler says:</p>
  
  <blockquote>
    <p>Unreachable catch block for jcalc.ParenthesisException. This exception is never thrown from the try statement body</p>
  </blockquote>
  
  <p>but I <em>did</em> throw it, here, in parseFormula:</p>
  
  <pre><code>if(n_lpar != n_rpar)
      throw new ParenthesisException();
  </code></pre>
  
  <p>Oddly enough, when I remove the try/catch, it tells me that the exception isn't caught. This confuses me, because before, it said that <code>ParenthesisException</code> was never thrown, and now it says it is never caught, but <em>is</em> thrown.</p>
  
  <p>I'm wondering if this is related to the way they are all static members(the classes and functions), and how I can resolve this. </p>