Originally posted by james gong:
read the code first,why the sb1.equals(sb2) return a false valeu?
/*******************************************************//
public class TestClass
{
public static void main(String Args[])
{
StringBuffer sb1 = new StringBuffer("String");
StringBuffer sb2 = new StringBuffer("String");
String sb3 = new String("String");
String sb4 = new String("String");
if(sb1.equals(sb2))
{
System.out.println(" StringBuffer:I am reache here!");
}
else
System.out.println("StringBuffer:sorry!");
if(sb3.equals(sb4))
{
System.out.println(" String:I am reache here!");
}
else
System.out.println("String:sorry!");
}
}
//*******************************************************//
Originally posted by Cindy Glass:
What warning?