Computer Applications
How are Strings different from StringBuffers ?
Java String Handling
3 Likes
Answer
The string objects of Java are immutable i.e., once created, they cannot be changed. If any change occurs in a string object, then original string remains unchanged and a new string is created with the changed string.
On the other hand, StringBuffer objects are mutable. Thus, these objects can be manipulated and modified as desired.
Answered By
3 Likes
Related Questions
Which of these is an incorrect statement?
- String objects are immutable, they cannot be changed.
- When you assign a new value to a String object, Java internally creates another String object.
- StringBuffer is a mutable class that can store sequence of characters.
- String objects are actually arrays of characters.
What are String and StringBuffer classes of Java?
How can you convert a numeric value enclosed in a string format ?
Write the return type of the following library functions:
- isLetterOrDigit(char)
- replace(char, char)