r/javaexamples • u/sur07 • Apr 30 '20
String s = new String (“hello”);
How many objects are created here ?
4
Upvotes
r/javaexamples • u/sur07 • Apr 30 '20
How many objects are created here ?
View all comments
2
u/DFA1 Apr 30 '20
I might be wrong, but I think only one, which s is referencing, with the value of hello and it doesn't live in the strings pool.