Hi friends,
PLease look at the code below-
code:-
_________________________________________________________________
class Great
{
public static void main(
String[] args)
{
StringBuffer sb=new StringBuffer("Hello");
StringBuffer sb1=new StringBuffer("Hello");
//String sb=new String("Hello");
//String sb1=new String("Hello");
System.out.println(sb.equals(sb1));
}
}
_________________________________________________________________
In the code above when I compare sb & sb1 as String the output I get is True, while as StringBuffer the output as false.
Can anyone tell me why is that so, as this is the case of deep checking, so I think in both cases the output should be true.