Answer Posted / 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 |
Post New Answer View All Answers
Is math an abstract class in java?
What is java used for?
Why do we create public static method in java?
What is difference between checked and unchecked exception in java?
what is nested class in java?
What is sortedset in java?
What is difference between an object and a class?
What does bitwise or mean?
What is private static in java?
What are the basics of core java?
Which is better stringbuffer or stringbuilder?
Explain covariant method overriding in java.
Can a constructor be made final?
What is methodological framework?
Why does java not support pointers?