title: Java - throws not working for a subtype of an exception that is handled
body: <p>Take this as example:</p>
  
  <pre><code>public class TestClass {
  
      public static void test() throws SSLHandshakeException {
          throw new SSLHandshakeException("I'm a SSL Exception");
      }
  
      public static void main(String[] args) throws SSLHandshakeException {
          try {
              test ();        
          } catch (IOException ioe) {
              System.out.println("I`m handling IO exception");
          }       
      }
  }
  </code></pre>
  
  <p>So, I have my test method in which I'm just throwing an <code>SSLHandshakeException</code> which is a subtype of <code>IOException</code>.</p>
  
  <p>The output for this is "I`m handling IO exception".</p>
  
  <p>Why does this happen? I expected that my method will throw the <code>SSLHandshakeException</code>. Is there a rule that <code>catch</code> is more important than <code>throws</code>?</p>
  
  <p>I just want to avoid using </p>
  
  <pre><code>try {
     test ();     
  } catch (SSLHandshakeException se) { 
     throw se; 
  } catch (IOException ioe) {
     System.out.println("I`m handling IO exception");
  }   
  </code></pre>
  
  <p>Because I consider it less readable</p>