What is the difference between String and StringBuffer classes?

String class objects are immutable and hence their contents cannot modified whereas StringBuffer class objects are mutable, so they can be modified.

Moreover the methods that directly manipulate data of the objects are not available in String class and such methods are available in StringBuffer class.

No comments:

Post a Comment