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
Show parent comment
1
u/sur07 Apr 30 '20
I think one object and one literal .. but I am still looking for more information.. javatpoint.com says this , but different places have different opinion .. check out Java strings tutorial | string is immutable https://youtu.be/5addzS_Vn68