0

String s = "abc";

This statement creates one String object. But how? Isn't object creation linked to Constructor? How is an object being created here without use of Constructor?

shanti
  • 270
  • 1
  • 4
  • 20
  • @Sam Yes, a bit similar. But there also, there is no answer of "how"? Also, what about the Constructor part? Isn't Constructor supposed to be used in some way to create object? Is a constructor being invoked internally somehow in this case? – shanti Jun 11 '16 at 10:56
  • You can also refer to http://stackoverflow.com/questions/334518/java-strings-string-s-new-stringsilly – Tunaki Jun 11 '16 at 11:06
  • Ahh, nowhere I can find a simple answer. How? And what about constructor? – shanti Jun 11 '16 at 11:11

0 Answers0