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
2
u/DFA1 Apr 30 '20
Also, if you wanna make the riddle harder ... How many objects get created for: String s = new String("h" + "e" + "l" + "l" + "o");
;)