package com.java;
public class ToEquals {
/**
* @param args
*/
public static void main(String[] args) {
Cat c1=new Cat(1,2,3);
Cat c2=new Cat(1,2,4);
System.out.println(c1.Equals(c2));
}
}
class Cat{
private int color;
private int width;
private int height;
Cat(int c,int w,int h){
color=c;
width=w;
height=h;
}
public boolean Equals(Object obj){
if(obj==null) return false;
else{
if(obj instanceof Cat){
Cat cat=(Cat)obj;
if((this.color==cat.color)&&(this.width==cat.height)&&(this.height==cat.height))
return true;
}
}
return false;
}
}