4 ms·
This isn't about exceptions, though it is certainly part of the problem. Try, catch, finally blocks are commonly used to ensure that resources are released once
by teilo 16y ago
This isn't about exceptions, though it is certainly part of the problem. Try, catch, finally blocks are commonly used to ensure that resources are released once they are no longer used. It not only forces you to remember to close the resources, it also forces you to think about what happens if something in your code breaks, and you have these open resources still in use. It's practically the entire reason that the "finally" block exists.