| 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". |