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?

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
To determine the number of objects eligible for garbage collection at the end of the main method let... View full answer
Get step-by-step solutions from verified subject matter experts
