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 is the major drawback of internal iteration over external iteration?
What is the difference between import java.util.date and java .util?
Explain about the performance aspects of core java?
How many bytes is a string?
How do you find the maximum number from an array without comparing and sorting?
What are disadvantages of java?
What are keywords and reserved words in java?
What is the synonym of string?
What is the purpose of static methods and static variables?
If a method is declared as protected, where may the method be accessed?
How many ways can an argument be passed to a subroutine and explain them?
Why are global variables used?
When should the method invokelater() be used?
What do you mean by default constructor in java?
What do you mean by JVM?