7
Catch Blocks
•A catch clause begins with the key word catch and has a parameter list consisting of the type of the exception and a variable name.
–
–catch (ExceptionType ParameterName)
–
•The code between the required curly braces following the catch clause will be executed if the try block throws the referenced exception.
•The Java Virtual Machine searches for a catch clause that can deal with the exception
.
Discuss again what happens if there isn’t a catch clause that will deal with the particular exception.
Show ReadFromFile.java