package com.zhanzhuang.exception; public class CustomizeException { public static void main(String[] args) { judge(); } public static void judge() { int a = 2; int b = 1; if (a > b) { try { throw new MyException("true"); } catch (MyException e) { e.printStackTrace(); } } else { try { throw new MyException("false"); } catch (MyException e) { e.printStackTrace(); } } } } class MyException extends Exception { public MyException(String message) { super(message); } }