Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is diff string and stringbuffer

Answer Posted / monika

string is immutable, that is it can not be extended.whereas
StringBuffer is mutable and can be extended.
Fro example :
Consider 2 statement : "Welcome " and "to Java World".
now assign first statement to string and string buffer.
String str = "Welcome" & StringBuffer strBuff = new
StringBuffer("Welcome");
Now if we add 2nd statement to both then :
str= str + "to Java World" -> In this case, it would dump
all the memory allocated with "welcome" and allocate a new
memory space to the entire string "Welcome to Java World" .
On the other hand, in strBuff :-
strBuff.append("to Java World") -> if simply allocate a
new memory space to only 2nd statement and add to link to
previous name.

Is This Answer Correct ?    51 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you understand by synchronization? Why is it important?

996


what is mean by hasing and maping in java platform and advantage?

2317


Which server-side script takes the input from JavaScript, can access the database if it needs to, and processes the data.

2041


What are the different types of collections views being provided by the map interface? : java collections

978


What are the considerations to be made in case of loops in java ?

984


who will give req's to u?. how they send req's to u? . what design documents contains?. when bugs raised on other developer code how to report to them?.(throgh mail or ........). how to retrive 100 recods from dao layer to presentation layer.using which collection?. what is sequence diagram.?.

2275


Hi we have an urgent requirement for Java/J2ee technical lead position & also looking for "Java Guidewire claimcentre" experienced professional for Bangalore location if interested can reach srisanh@gmail.com

2936


What are the differences between the java collection and the java list? : java collections

1049


my interviewer asked me what technical specification you used how to answer that question

2322


What are the different types of classes implemented in the set interfaces? : java collections

1008


Explain the OOPS concept in Realtime Scenarion ? Take example as CAR. Please explain indetail ?

2986


HOW MUCH PERCENTAGE WE DEDUCT FOR OUR SUPPLIERS OR OTHER PROFESSIONALS

1999


What is the use of the list interface in the java collection? : java collections

977


What is the enumerator of the java collection framework? : java collections

985


How is hashset maintained in memory by java ?

1092