class MyException extends Exception { } public class GenericsTest { public static void main(String[] args) throws MyException { Thrower thrower = new Thrower() { public void throwIt() throws MyException { throw new MyException(); } }; thrower.throwIt(); } }