Need some additional clarification...
public void findOut(Integer y){
y = null;
}
My understanding....
In the above method the argument passed to the method "findOut" is an Object
Reference. Meaning its just a some combination of bit-pattern that takes us back to the same object from the calling method.
So Integer y in the method "findOut" and the Integer x in the calling method should be pointing to the same object on the heap
as "y" inside "findOut" is only a reference...am I right??
If right then I guess when Integer y in the method "findOut" is set to null then the corresponding Integer x in calling method will also be assigned to null and hence becomes eligible for GC...
Let me know if I am missing something here??
- Mel