Question: How many of the String objects are eligible for garbage collection right before the end of the main() method? A. None B. One C. Two

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

public static void main(String[] ohMy) { String animal1 = new String("lion"); String

A. None

B. One

C. Two

D. Three

E. None of the above

public static void main(String[] ohMy) { String animal1 = new String("lion"); String animal2= new String("tiger"); String animal3 = new String("bear"); } animal3 animall; animal2 animal3; animall animal2;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To determine the number of String objects that are eligible for garbage collection by the end of the ... 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!