String is an inflexible (immutable) class, i.e. you can not modify its content once created.
While StringBuffer is a mutable (variable, change-able ) class, means you can change its content later. Whenever we alter content of String object, it creates a new string and refer to that,it does not modify the existing one. This is the reason that the performance with StringBuffer is better than with String.
While StringBuffer is a mutable (variable, change-able ) class, means you can change its content later. Whenever we alter content of String object, it creates a new string and refer to that,it does not modify the existing one. This is the reason that the performance with StringBuffer is better than with String.
Thanks for sharing Talu 5
ReplyDeleteTalu Bhai
ReplyDelete