If the run-time type of V is assignment compatible with (§5.2) a catchable exception class of any catch clause of the try statement, then the first (leftmost) such catch clause is selected.
最左边是什么?我们从上到下放置 catch 子句,例如:
try{ }
catch(IndexOutOfBoundException e){ }
catch(SQLException e){ }
catch(NullPointerException e){ }
//etc
最佳答案
这与 Java 的任何新语言特性无关。
术语“最左边”仅适用于最早出现的 catch 子句。将代码想象成一维标记序列,从左向右延伸。这就是语言解析器的看法。
因此,所有规定都是输入第一个匹配的 catch-clause。
关于java - 该定义中的 "leftmost"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26178156/