- #1
russel.arnold
- 41
- 0
Hi,
I have a class, say myclass and it takes two strings (let s and g ) and one int ( say i) as its arguments.
It looks like, public class {
String s , g;
int i ;
public void myclass(String sname, String gname, int k){
s = sname;
g = gname;
i = k;
}
}
Now, I have several objects of this class with different values of s, g and i. I want to compare them for equality. i.e if two class objects have same s g and i value, then i want true as my output.
I know this can be done by a loop but is there any shorter way to do this?
I have a class, say myclass and it takes two strings (let s and g ) and one int ( say i) as its arguments.
It looks like, public class {
String s , g;
int i ;
public void myclass(String sname, String gname, int k){
s = sname;
g = gname;
i = k;
}
}
Now, I have several objects of this class with different values of s, g and i. I want to compare them for equality. i.e if two class objects have same s g and i value, then i want true as my output.
I know this can be done by a loop but is there any shorter way to do this?