aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes using plus inside StringBuffer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic
Author

using plus inside StringBuffer

kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 323
HI all
Suppose i have 3 variables. If i write like this
StringBUffer sb = new StringBuffer("[");
sb.append("',"+variable1+",'");
sb.append("',"+variable2+",'");
sb.append("',"+variable3+",'");
Is this code creating new string objects because of using + inside append.

THanks
kundan


SCJP1.4,SCBCD,SCEA,CNA
Failures are practice shoots for success.
Vicky Jain
Ranch Hand

Joined: Aug 02, 2003
Posts: 52
Yups kundan,

Those string were created in the String pool.

ThanQ
[ August 25, 2004: Message edited by: Vicky Jain ]

SCJP1.4(96%)<br />A drop of ink can make millions think.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
This is a duplicated topic so I'm closing it. Please post your responses here
[ August 25, 2004: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: using plus inside StringBuffer
 
It's not a secret anymore!