InterviewSolution
Saved Bookmarks
| 1. |
How Many Objects Will Be Created If Two Strings Are Created This Way? String S1 = “test”; String S2 = “test”; |
|
Answer» SINCE s1 and s2 are string literals and having the same content object reference will be shared by them in the string POOL. Therefore only one object is CREATED. Since s1 and s2 are string literals and having the same content object reference will be shared by them in the string pool. Therefore only one object is created. |
|