what is mutability?which one is mutable String or StringBuffer?and why?give
examples of each which shows the mutability of each String or StringBuffer
Answer Posted / arjunkumar
Mutability means data which we can change.
StringBuffer class is mutable, because it can change its
data where as String class cant.
Example:
If you want to combine two strings we have two methods i.e
append() method and concat() method.
here append() is used to append the 2nd string to 1st string
and it can store in memory. where as concat() method is
combine the 2nd string to 1st string but it is not actuly
stored in memory it just show to us as combind
| Is This Answer Correct ? | 4 Yes | 4 No |
Post New Answer View All Answers
What sorting algorithm does javascript use?
What are the types of strings?
What does i ++ mean in Java?
What is final int?
How to sort an array in java without using sort method?
What’s a deadlock?
What is double data type?
What is difference between throw and throws ?
Why java is made?
How to read and write image from a file ?
What is t in parametric equations?
Is the milky way in a void?
What is the function of compareto in java?
Can you override a final method?
How many boolean functions are there?