Will an object declared in method subject to garbage collection?
- by SiLent SoNG
Consider an object declared in a method:
public void foo() {
Object obj = new Object();
// A long run job that consumes tons of memory and
// triggers garbage collection
}
Is obj subject to garbage collection?