package using_object_as_parameter;
public class Make {
int a,b;
Make(int i,int j){
a=i;
b=j;
}
boolean equals(Make o){
if(o.a==a &&o.b==b)return true;
else return false;
}
}
public class Passob {
public static void main(String[] args) {
Make obj = new Make(100,22);
Make obj1 = new Make(1,2);
System.out.println("obj==obj1:"+obj.equals(obj1));
}
}
The output of this code is:
run:
obj==obj1:false
BUILD SUCCESSFUL (total time: 3 seconds)
0 comments:
Post a Comment