Yes, e is out of scope outside of the catch block.
(The scope of a parameter of an exception handler that is declared in a catch clause of a try statement is the entire block associated with the catch. JLS 14.19)
Whether an object is reachable when the reference variable goes out of scope is a topic of much debate on this forum.
The GC source I am relying on is
Appendix A The Truth About Garbage Collection from the book
Java Platform Performance, whose authors are engineers of the
Java Performance Team at Sun.
I am going to apply Section A.3.3 of JPP quoting as much as possible, so that I do not get it wrong.
When a reference variable declared in a block goes out scope, it might seem that the variable would be pulled off the stack and the associated object would become unreachable. After all, outside of the block, there is no syntax defined that would allow the program to access the object again. However, an efficient implementation of the JVM is unlikely to zero the reference when it goes out of scope. The object continues to be strongly referenced, at least until the method returns.
Some people say an optimizing JVM will null a stack reference variable when the variable goes out of scope. The authors of the Java Platform Performance say just the opposite. An efficient JVM will not null the stack reference variable when the variable goes out of scope.
[ October 19, 2003: Message edited by: Marlene Miller ]