public class users { String name; static int age; public boolean equals(Object obj) { if(this==obj){ return true; } boolean b=obj instanceof users; if(b){ users u=(users)obj; if(users.age==u.age&&this.name.equals(u.name)){ return true; } else { return false; } } else { return false; } } public static void main(String[] args) { users u1=new users(); users u2=new users(); users u3=u1; u1.name="zhangsan"; u1.age=11; u2.name="zhangsan"; u1.age=11; System.out.println(u1.equals(u2)); } }