用MyEclipse编辑这节的contains运行错误,求高手解答
用MyEclipse这节的contains运行错误,求高手解答
用MyEclipse这节的contains运行错误,求高手解答
2016-03-26
public void testListCourse(){
Course crr = new Course();
System.out.println("请输入查询的课程名称:");
String name = input.next();
crr.setName(name);
System.out.println("是否包含该课程:"+courses.contains(crr));
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Course))
return false;
Course other = (Course) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
用debug调试是正确的???
举报