View Single Post
Old 07-12-06, 07:54 PM   #3 (permalink)
abeethabsl
Senior Member
 
Join Date: Dec 2006
Posts: 699
Thanks: 3
Thanked 18 Times in 13 Posts
Rep Power: 12 abeethabsl is a jewel in the rough abeethabsl is a jewel in the rough abeethabsl is a jewel in the rough
Re: String and StringBuffer

Hi suma,

Both String and StringBuffer are final classes.
But String is immutable.Once an instance of it is created one cannot change its contents, though all operations are possible.
For eg:to concate String s1="ABC" and String s2="DEF" we need another string
String s3=s1+s2;which will have the value of "ABCDEF";One cannot append it to s1.
But StringBuffer is mutable and one can change the contents of it.The same scenario in this case can be s1.append("DEF");s1 becomes "ABCDEF".
abeethabsl is offline Offline   Reply With Quote