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 are the types of collections in java?
What is an association?
Difference between overriding and overloading in java?
What is the access scope of protected access specifier?
What happens if we override only equals?
What are the steps involved to write rmi based programs?
How do you break a loop?
If a method is declared as protected, where may the method be accessed in java programming?
what is the difference between future and callable interface in java?
What are desktop procedures?
How many ways can we create the string object?
How do you add an arraylist to an array in java?
Does windows 10 need java?
What is singleton class in java and how can we make a class singleton?
Is boolean a data type in java?