标签:void equal his 重写 package AC OLE == bean
package com.day15.bean;
public class Person {
private String name;
private int age;
public Person() {
super();
}
public Person(String name, int age) {
super();
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public boolean equals(Object obj) {
Person p=(Person)obj;
return this.name.equals(p.name)&&this.age==p.age;
}
}
标签:void equal his 重写 package AC OLE == bean
原文地址:https://www.cnblogs.com/zhujialei123/p/9002244.html