Difference String and String Buffer
Answers were Sorted based on User's Feedback
Answer / parameswaran
String is immutable object..we can't modified the value...
but string buffer is mutable object we can change.
>>It can increase or decrease the size dynamically..
>>It contains Max 255 characters..
Warm & Regards
Parames(PRC)
Thanjavur
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / kanchan
String are read only and immutable. The StringBuffer class
is used to represent characters that can be modified.
StringBuffer is faster than String when performing simple
concatenations.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / gangabusi
String is immutable, we can not modify the string objects.
if we can create any string object
Ex: String S="Ganga";
here 'S' is string object created in heap memory.
I Want to add Something to S,
String S="Gangadhar";
Here In heap momory one more object is created for 'S',not
overridden.So that each and every updation String create
one new object in heap.
StringBuffer sb="Ganga"
here 'sb' is stringbuffer object created in heap memory.
I Want to add Something to sb,
StringBuffer sb="Gangadhar";
Here In heap momory 'sb' is overridden.So that each and
every updation StringBuffer create an object in stack.
It is mutable and it is Synchronized.(one thread process at
a time)
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / a kumar
String buffers are safe for use by multiple threads
| Is This Answer Correct ? | 0 Yes | 2 No |
What are the topics in advance java?
Why do we need autoboxing in java?
What is an object's lock and which object's have locks in java programming?
What will happen if non-synchronized method calls a static synchronized method and what kind of lock it acquires?
Program to output as below formate: 1 2 3 4 5 6 7 8 9 10
What is string in java? String is a data type?
why we are calling j2se why not j1se or j3se or j4se..etc is there any reason.. can u please explain it... i shocked in my interview when they asked this question please explain ans
What is the difference between equals() and == in java?
write a simple program inheritance?
how to handle a singleton service locator. when multiple threads are trying to get the singleton object in same time
What is the benefit of singleton pattern?
how to deploy apache tomcat server to weblogic server in java