Refrence to and Integer being returned scope of Integer
posted 7 years ago
In the following code, I'm assuming the copy of the reference newStats is being returned to the calling method, but does the array die out when the method(gerAllStats) completes, setting the values all to null.
When the method returns, the newStats reference goes out of scope and can't be used to reach the Integer array object. As for the Integer array object, that would depends on what happens after the method returns. If another reference refers to it, it will remain reachable, and live on.