String and new String("')
807569May 16 2006 — edited May 16 2006Hi Friends,
Hope you all are doing good!
String str1 = new String ("abc");
String str2 = "bcd";
The first one is an object and the second one a variable.
Is the second one a primitive one?
How is the storage for both cases handeled?
I mean is it right to say that first one is stored on HEAP since all objects are stored on HEAP.
While the second is stored on STACK (But i think this is wrong and a bit confusing)..
Would appreciate any replies from your side
Thanks,
Vishal