java异常
public class MyException extends Exception{ public MyException() { super(); } public MyException(String name) { super(name); } public static void main(String args[]) throws MyException{ try{ Integer i = new Integer(-1); if(i < 0) { throw new MyException(); } } catch(MyException e){ System.out.println("有错误"); } } }