Hi ,
Does StringBuffer act the same way as
String when using equals method? If not,can anyone explain me the o/p of this program.
class sb1
{
public static void main(String a[])
{
StringBuffer sb1 = new StringBuffer("avn");
StringBuffer sb2 = new StringBuffer("avn");
String ss= "avn";
System.out.println(sb1==sb2);
System.out.println(sb1.equals(sb2));
System.out.println(sb1.equals(ss));
}
}
O/P:false.false,false.
thanks