| Author |
How many objects created?
|
Shubhada Nandarshi
Ranch Hand
Joined: Jun 10, 2005
Posts: 59
|
|
1. StringBuffer s1 = new StringBuffer("abc"); 2. StringBuffer s2 = s1; 3. StringBuffer s3 = new StringBuffer("abc"); How many objects are created ? 1. 0 2. 1 3. 2 4. 3 Answer : 4 How?? Because, s1,s2 & s3 are references to the object not the objects themself.The s2 will refer to the object created by the s1,then how 3 objects are created? the ans should be 3rd option 2. Plz explain me if I am wrong.
|
Shubhada
|
 |
Timmy Marks
Ranch Hand
Joined: Dec 01, 2003
Posts: 226
|
|
|
How is this question different from the other discussion in the same forum?
|
 |
Shubhada Nandarshi
Ranch Hand
Joined: Jun 10, 2005
Posts: 59
|
|
sorry Timmy , I didn't see the other discussion forum.As I got confused I asked in forum.
|
 |
 |
|
|
subject: How many objects created?
|
|
|