Question: QUESTION 5 Given the following code and assuming Truck is a valid class with a default constructor: Truck hertz, uhaul=new Truck(); Truck pickup=null; hertz =

 QUESTION 5 Given the following code and assuming Truck is a

QUESTION 5 Given the following code and assuming Truck is a valid class with a default constructor: Truck hertz, uhaul=new Truck(); Truck pickup=null; hertz = uhaul; uhaul = new Truck(); Which is true? A. The memory for the instance allocated on the first line (to uhaul) will NOT be garbage collected since it is referenced by hertz. B. The memory for the instance allocated on the first line (to uhaul) will be garbage collected since uhaul is now pointing to a different instance. C. The will resut in an error since you cannot assign two variables to the same instance. D. Three instances of Truck are essentially created by this code. O E. No instances of Truck are created with this code

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!