在Java中,以下哪个选项正确地展示了使用单个catch块捕获多个异常的方式? A. catch(IndexOutOfBoundsException | NumberFormatException e) { e.printStackTrace(); } B. catch(IndexOutOfBoundsException e) { e.printStackTrace(); } catch(NumberFormatException e) { e.printStackTrace(); } C. catch(IndexOutOfBoundsException, NumberFormatException e) { e.printStackTrace(); } D. catch(IndexOutOfBoundsException NumberFormatException e) { e.printStackTrace(); } 答案解析 选项A正确地使用了管道符(|)来分隔多个异常类型,这是JDK1.7引入的特性,允许在单个catch块中捕获多个异常。选项B虽然也能捕获多个异常,但使用了多个catch块,不符合题目要求。选项C和D的语法错误,不符合Java的异常捕获语法。 正确答案:A