Monday, February 16, 2009

Difference between String and StringBuffer class

Hello all , String s = "abc";
String s2 = new String("abc");
if(s==s2) // this is true
then
String s = "abc";
String s2 = new StringBuffer("abc").toString();
if(s==s2) // this condition will be false
What is the difference between this two codes.
Anyone knows the core reason behind this can put the comment here.
Thanks
Chetan Dhumane

No comments:

Post a Comment