Question: How many objects are eligible for garbage collection at the end of the main() method? A. None. B. One. C. Two. D. Three. E. The

How many objects are eligible for garbage collection at the end of the main() method? 

package store; public class Shoes { static String shoel = new String("sandal");

A. None.

B. One.

C. Two.

D. Three.

E. The code does not compile.

F. None of the above.

package store; public class Shoes { static String shoel = new String("sandal"); static String shoe2 = new String("flip flop"); public void shopping () { String shoe3 = new String("croc"); shoe2 = shoel; shoel = shoe3; } } public static void main(String... args) { new Shoes().shopping(); }

Step by Step Solution

3.47 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To determine the number of objects eligible for garbage collection at the end of the main method let... View full answer

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 Oracle Questions!