public class JavaTest { public static void main(String[] args) { Parent child=new Child(); try { child.test(); } catch (MyException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } class MyException extends Exception { /** * */ private static final long serialVersionUID = 1L; public MyException() { super(); } public MyException(String msg) { super(msg); } } class Parent { private Parent parent; public Parent() { // TODO Auto-generated constructor stub } public Parent(Parent parent) { this.parent=parent; } void test() throws MyException { } } class Child extends Parent { public Child(Parent parent) { super(parent); // TODO Auto-generated constructor stub } Child() { } void test() throws MyException { } }