How to define custom exception class in Java, the easiest way?
<p>I'm trying to define my own exception class the easiest way, and this is what I'm getting:</p>

<pre><code>public class MyException extends Exception {}

public class Foo {
  public bar() throws MyException {
    throw new MyException("try again please");
  }
}
</code></pre>

<p>This is what Java compiler says:</p>

<pre><code>cannot find symbol: constructor MyException(java.lang.String)
</code></pre>

<p>I had a feeling that this constructor has to be inherited from <code>java.lang.Exception</code>, isn't it?</p>
