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
If a class is declared without any access modifiers, where may the class be accessed in java programming?
What is arrays aslist in java?
How many bytes is string in java?
What is array pointers ?
What is derived datatype?
Can we serialize singleton class?
Which sorting algorithm is in place?
How does linkedhashmap work in java?
What is difference between static and abstract class?
Explain importance of inheritance in java?
Explain about narrowing conversion in java?
How is java created?
Why can't we override private static methods?
Can we define private and protected modifiers for variables in interfaces?
Explain where variables are created in memory?