I am facing one problem in this type of pro-gramme where i use Class name as a Return type or pass object as an argument like here , i am getting same error(the class already defined), i am using eclipse.
****class Test //showing error that the class Test already defined
{
int a,b;
Test(int i,int j){
a=i;
b=j;
}
boolean equals(Test o){
if(o.a==a&&o.b==b)
return true;
else return false;
}
}
public class Object2 {
public static void main(String[]args){
Test ob1=new Test(10,20);
Test ob2=new Test(30,40);
Test ob3=new Test(10,20);
System.out.println("ob1==ob2 is" + ob1.equals(ob2));
System.out.println("ob2==ob3 is" + ob2.equals(ob3));
System.out.println("ob1==ob3 is" + ob1.equals(ob3));
}
}