Java中可以使用多个catch块来捕获不同类型的异常,但是如果多个catch块中的异常类型有重叠,就会出现编译错误。为了解决这个问题,可以使用管道符“|”将多个异常类型合并成一个异常列表。 例如: ``` try { // some code that may throw exceptions } catch (IOException | SQLException e) { // handle IOException or SQLException } catch (Exception e) { // handle other exceptions } ``` 在上面的代码中,第一个catch块使用管道符将IOException和SQLException合并成一个异常列表,这样就可以捕获这两种异常类型了。第二个catch块则捕获其他类型的异常。