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 downcasting?
Is java free for commercial?
Can an object be null?
Why java is made?
What about interrupt() method of thread class ?
Which container method is used to cause a container to be laid out and redisplayed in java programming?
What is udp in java?
Where is stringbuffer stored?
What is difference between module and function?
What happens to a static var that is defined within a method of a class?
What is constructor chaining in java?
What is flag in python?
How does the java compiler work?
Write a program to reverse a number in java?
Difference between collection, collection and collections in java?