Java自定义异常类简单事例
程序员文章站
2024-01-08 16:10:10
...
public void MyException extends Exception{ public MyExceprion(){ System.out.println("自定义异常"); } } public class Exam{ public static void mul() throws MyException{ if(自己写条件){ throw new MyException(); } } }