| Author |
Number of objects created in StringBuilder ?
|
Lovleen Gupta
Ranch Hand
Joined: Feb 26, 2007
Posts: 63
|
|
I know -- if it had been string here like :: String s = new String("abc"); 2 objects are created. But, how many objects are created when we say -- StringBuilder sb = new Stringbuilder("abc"); Thanks.
|
 |
Vassili Vladimir
Ranch Hand
Joined: Mar 08, 2007
Posts: 1585
|
posted

0
|
Hallo, When using StringBuffer, the case is one-by-one, meaning, one object and one reference. So, when we say: There will be this one object on the heap with stringBuffer referring to it. Good luck ...
|
Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
|
 |
Vassili Vladimir
Ranch Hand
Joined: Mar 08, 2007
Posts: 1585
|
posted

0
|
Sorry i forgot to say that StringBuffers don't go to the String constant pool.
|
 |
 |
|
|
subject: Number of objects created in StringBuilder ?
|
|
|