标签:
public class StringEquals {
/** * @param args the command line arguments */
public static void main(String[] args) {
String s1=new String("Hello");
String s2=new String("Hello");
System.out.println(s1==s2);
System.out.println(s1.equals(s2));
String s3="Hello";
String s4="Hello";
System.out.println(s3==s4);
System.out.println(s3.equals(s4));
}
}
其实现方法为: System.out.println(s3.equals(s4))
标签:
原文地址:http://www.cnblogs.com/94qq/p/4906485.html