previous |
start |
next
The finally Clause
- Exception terminates current method
- Danger: Can skip over essential code
- Example:
BufferedReader in;
in = new BufferedReader(
new FileReader(filename));
purse.read(in);
in.close();
- Must execute in.close() even if exception happens
- Use finally clause for code that must be executed "no
matter what"
previous |
start |
next