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 finally block?
Write a java program to check if a number is prime or not?
What are byte codes?
Difference between Preemptive scheduling vs. Time slicing?
Is 0 an even number?
How to disable caching on back button of the browser?
What is treemap in java?
What is object cloning in Java?
if u open login & logout ,how can udisplay the timelogin & logout members ?
What is the difference between the boolean & operator and the && operator in java programming?
Why heap memory is called heap?
What are the methods of object class ?
What is the difference between variable declaration and variable initialization?
What comes to mind when someone mentions a shallow copy in java?
how are methods defined?