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
What is the use of static methods?
What is the list interface in java programming?
Can you extend singleton class?
What is finalize method?
What is the relationship between clipping and repainting under awt?
What is difference overloading and overriding?
What are the parts of a method?
How to disable caching on back button of the browser?
How does regex work?
What initialize variables?
What is array in java?
What do the thread?class methods run() and start() do?
What are the different http methods?
What do you understand by the bean persistent property?
What are strings in physics?