Enerjy 这行代码有问题:
private static List<ParseTree> getTestTrees(Xml test) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
这是警告:
(Baseline) JAVA0126 Method 'getTestTrees' declares unchecked exception 'IllegalArgumentException' in throws
我该如何解决这个问题?问题是什么? “未检查”异常是什么意思?
最佳答案
“未检查”异常(也称为 runtime exceptions )是编译器不强制您捕获的异常。例如,想象一下,如果您必须在任何可能发生的地方声明并捕获 NullPointerException。这些是异常类型,如果发生,则假设您的程序可能无论如何都无法恢复。
编译器告诉您从方法的 throws
子句中删除 IllegalArgumentException
。
关于Java:Enerjy - 未经检查的异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1888824/