首页 > 代码库 > java 判断是不是检查性异常

java 判断是不是检查性异常

    /**     * Return whether the given throwable is a checked exception:     * that is, neither a RuntimeException nor an Error.     * @param ex the throwable to check     * @return whether the throwable is a checked exception     * @see java.lang.Exception     * @see java.lang.RuntimeException     * @see java.lang.Error     */    public static boolean isCheckedException(Throwable ex) {        return !(ex instanceof RuntimeException || ex instanceof Error);    }

 

java 判断是不是检查性异常