I read that the finally block is used to release non-memory resources.
On the other hand, nonmemory resources like file handles and socket handles must be explicitly released by the program, using methods with names like close(), destroy(), shutdown(), or release().
Why are these resources called non-memory? Even if I open an RMI socket, I agree that the objects are constructed on a different heap area (diff. JVM), but still it comsumes some area in my JVM? Also, why IO streams called as non-memory resources?
Do you really mean try, catch, finally? Or the overridden Object.finalize() method?
For the SCJP you only need consider resources in the same JVM. An IO stream would be allocated an operating system resource (a filehandle) which you should return if not being used. [ November 30, 2006: Message edited by: Barry Gaunt ]