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 identifier in java?
What is console based application in java?
What is executor memory?
What is a java lambda expression?
What is string intern in java?
What is the maximum size of hashmap in java?
What language is java written?
Explain parallel processing in java8?
What is the method to expand and collapse nodes in a jtree?
Can a abstract class be declared final?
Where is java located?
how to create constants in java?
What is a java list?
How hashmap works in java?
Can we nested try statements in java?