package HspLearningPoly.poly01;
public class ObjPerson {
public static void main(String[] args) {
Person person1 = new Person();
person1.name = "yang";
Person person2 = new Person();
person2.name = "yang";
System.out.println(person1 == person2);
System.out.println(person1.name.equals(person2.name));
System.out.println(person1.equals(person2));
String s1 = new String("abs");
String s2 = new String("abs");
System.out.println(s1.equals(s2));
System.out.println(s1 == s2);
}
}
class Person {
public String name;
}
false
true
false
true
false
网友评论