第一段
package jhfj;
import java.util.Objects;
public class Person {
String Name;
String Address;
String telephone;
public Person() {
}
public Person(String Name,String address,String telephone) {
super();
this.Address=Address;
this.Name = Name;
this.telephone = telephone;
}
@Override
public int hashCode() {
return Objects.hash(Address, Name, telephone);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Person other = (Person) obj;
return Objects.equals(Address, other.Address) && Objects.equals(Name, other.Name)
&& Objects.equals(telephone, other.telephone);
}
@Override
public String toString() {
return "Person [Name=" + Name + ", Address=" + Address + ", telephone=" + telephone + "]";
}
}
第二段
package jhfj;
import java.util.Objects;
public class employee {
String offic;
public String getOffic() {
return offic;
}
public void setOffic(String offic) {
this.offic = offic;
}
public String getWage() {
return wage;
}
public void setWage(String wage) {
this.wage = wage;
}
String wage;
public employee() {
}
public employee(String offic,String wage) {
super();
this.offic = offic;
this.wage = wage;
}
@Override
public int hashCode() {
return Objects.hash(offic, wage);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
employee other = (employee) obj;
return Objects.equals(offic, other.offic) && Objects.equals(wage, other.wage);
}
@Override
public String toString() {
return "employee [offic=" + offic + ", wage=" + wage + "]";
}
}