package Test;
public class dlms {
public static void main(String []ages){
String s1 = new String();
String s2 = new String();
System.out.println(s1==s2);
System.out.println(s1.equals(s2));
}
}
总结:==是比较引用是否相同
equals是比较值是否相同
package Test;
public class dlms {
public static void main(String []ages){
String s1 = new String();
String s2 = new String();
System.out.println(s1==s2);
System.out.println(s1.equals(s2));
}
}
总结:==是比较引用是否相同
equals是比较值是否相同