try {
// "protected code"
...
if (something_bad) {
throw Exception1(“SOMETHING BAD HAPPENED”);
}
...
} catch (Exception1 e) {
// handle an Exception1 exception here
} catch (Exception2 e2) {
// handle an Exception2 exception here
} catch (int I) {
// handle a “thrown” int exception here
} catch (...) {
// handle any other type of exception
}
Exception Handling
最新推荐文章于 2022-09-26 23:48:46 发布