Question: If you return a reference to an object which happens to be a method - local variable, the return happens before the method s local

If you return a reference to an object which happens to be a method-local variable, the return happens before the methods local variables are destroyed. So you can create an object in your method and return it knowing the calling method will have use of the object you just created. This is because when your local object reference is destroyed, the calling method has a ____________ to your object so the JVM will not destroy it since it has an active reference to it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!