This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
4. String s1 = new String("abc"); 5. String s2 = s1; 6. String s3 = new String("abc");
would create 3 object.
Please comment on this.
SCJA, SCJP5.0, SCBCD, SCWCD
shetal bansal
Ranch Hand
Joined: May 09, 2005
Posts: 63
posted
0
R u sure on the no. of objects created in second case as I think the second case will produce 2 objects.
Steven Bell
Ranch Hand
Joined: Dec 29, 2004
Posts: 1071
posted
0
Assuming this next section is done in complete isolation of the previous section.
If the two sections of code are loaded by the same ClassLoader then the "abc" String literal will only be loaded once.
Srinivasa Raghavan
Ranch Hand
Joined: Sep 28, 2004
Posts: 1228
posted
0
Same type of questions are asked in this forum many times. Please do a search to get more idea. [ June 23, 2005: Message edited by: Srinivasa Raghavan ]