package cn.itcast.hashcode.Demo;

public class Person {
	private String name;
	private int 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;
	}
	public Person(String name, int age) {
		super();
		this.name = name;
		this.age = age;
	}
	@Override
	public int hashCode() {
	System.out.println("hashcode..............."+this.name+" "+this.age);
//		return name.hashCode()+age;
	return 0;
	}
	@Override
	public boolean equals(Object obj) {
	System.out.println("equals..............."+this.name+" "+this.age);
		if(this==obj)
			return true;
		if(!(obj instanceof Person))
			throw new ClassCastException("ÀàÐÍ´íÎó");
		Person p=(Person)obj;
		return this.name.equals(p.name)&&this.age==p.age;
	}
//	public String toString()
//	{return name+":"+age;}

}
