catch Block
A block that handles a matching exception from its try block.
What is catch Block in Java?
catch Block — A block that handles a matching exception from its try block.
class OrderReader {
int readQuantity(String text) {
try {
return Integer.parseInt(text);
} catch (NumberFormatException error) {
return 0;
} finally {
closeReader();
}
}
void closeReader() {
}
}
Level: Journeyman · More Java terms at this level
Updated