java equals 小记

public class Employee{
/*
*显示参数为Employee,其结果没有覆盖Object的equals方法,而是定义了一个新的方法
*/
    public boolean equals(Employee other){
    return name.equals(other.name)&&salary==other.salary&&hireDay.equals(other.hireDay);    
    }
}

 

posted @ 2017-03-18 11:35  琴声清幽  阅读(122)  评论(0编辑  收藏  举报