这是在运行时检查异常是否为已检查异常的正确方法吗?
public boolean isChecked(final Throwable e) {
return !(RuntimeException.class.isAssignableFrom(e.getClass())
|| Error.class.isAssignableFrom(e.getClass()));
}
最佳答案
我想像下面这样的一些条件就足够了
return !(e instanceof RuntimeException || e instanceof Error);
关于java - 在运行时检查异常是否为已检查异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59825242/