try-catch怎么嵌套throw new ExceptionType(parameters)
时间: 2023-05-19 22:03:28 浏览: 137
C++语言处理异常 try catch throw
可以使用以下代码嵌套try-catch和throw new ExceptionType(parameters):
try {
// some code that may throw an exception
} catch (ExceptionType1 e1) {
try {
// some code that may throw another exception
} catch (ExceptionType2 e2) {
throw new ExceptionType3(parameters);
}
}
阅读全文