title: Exception is never thrown in body of corresponding try statement
body: <p>I have a problem with exception handling in Java, here's my code. I got compiler error when I try to run this line: <code>throw new MojException("Bledne dane");</code>. The error is:</p>
  
  <blockquote>
    <p>exception MojException is never thrown in body of corresponding try statement</p>
  </blockquote>
  
  <p>Here is the code:</p>
  
  <pre><code>public class Test {
    public static void main(String[] args) throws MojException {
      // TODO Auto-generated method stub
  
      for(int i=1;i&lt;args.length;i++){
        try{
          Integer.parseInt(args[i-1]);
        }
        catch(MojException e){
          throw new MojException("Bledne dane");
        }
        try{
          WierszTrojkataPascala a = new WierszTrojkataPascala(Integer.parseInt(args[0]));
          System.out.println(args[i]+" : "+a.wspolczynnik(Integer.parseInt(args[i])));
        }
        catch(MojException e){
          throw new MojException(args[i]+" "+e.getMessage());
        }
      }
    }
  }
  </code></pre>
  
  <p>And here is a code of MojException:</p>
  
  <pre><code>public class MojException extends Exception{
      MojException(String s){
          super(s);
      }
  }
  </code></pre>
  
  <p>Can anyone help me with this?</p>