ICSE Class 10 Computer Applications Question 2 of 36

String Handling — Question 2

Back to all questions
2
Question

Question 2

How are Strings different from StringBuffers ?

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.