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
What do you understand by synchronization? Why is it important?
what is mean by hasing and maping in java platform and advantage?
Which server-side script takes the input from JavaScript, can access the database if it needs to, and processes the data.
What are the different types of collections views being provided by the map interface? : java collections
What are the considerations to be made in case of loops in java ?
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.?.
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
What are the differences between the java collection and the java list? : java collections
my interviewer asked me what technical specification you used how to answer that question
What are the different types of classes implemented in the set interfaces? : java collections
Explain the OOPS concept in Realtime Scenarion ? Take example as CAR. Please explain indetail ?
HOW MUCH PERCENTAGE WE DEDUCT FOR OUR SUPPLIERS OR OTHER PROFESSIONALS
What is the use of the list interface in the java collection? : java collections
What is the enumerator of the java collection framework? : java collections
How is hashset maintained in memory by java ?