Equals相等(测试)
public class Test {
public static void main(String[] args) {
Person p = new Person("张无忌",18);
Person p1 = new Person("张san",18);
boolean e = p1.equals(p1);
System.out.println(e);
boolean b = p.equals(p1);//重写了父类equals方法 比较年龄 如果不重写 比较内存
System.out.println(b);
//调用Person类的方法toString()
//输出语句 写的是每一个对象 默认就调用toString();
System.out.println(p);
System.out.println(p1);
}