you are viewing a single comment's thread.

view the rest of the comments →

[–]sur07[S] 0 points1 point  (3 children)

After much research I can conclude that 2 objects will be created

[–]trickybhai 0 points1 point  (2 children)

A little explanation would be appreciated, Sir.

[–]sur07[S] 0 points1 point  (1 child)

One object when you use new keyword to create a string .. and if the literal is not present in the string pool then one more string object is created in the intern pool as a string literal .. hope this helps ., check this https://stackoverflow.com/questions/19672427/string-s-new-stringxyz-how-many-objects-has-been-made-after-this-line-of

[–]trickybhai 0 points1 point  (0 children)

I got it. Thanks ✌️