1

I was looking at this thread

In Java - How many string objects would be created in the following two scenarios?

String s1 = "Java";
String s2 = new String("Java");

and

String s1 = new String("Java");
String s2 = "Java";

Trying to wrap my head around Permgen string pools - I assumed there will always be two objects in both cases, One in the permgen pool and one in the heap, the one in the heap pointing to the reference in the string pool! Is this not correct?

Community
  • 1
  • 1
user2796381
  • 217
  • 1
  • 3
  • 12

0 Answers0