import java.util.*;
import java.text.*;
public class test6
{ /** * @param args */
int count;
test6(int s)
{count =s;
}
public static void main(
String[] args)
{// TODO Auto-generated method stub
HashSet<test6> set=new HashSet<test6>();
set.add(new test6(5));
set.add(new test6(5));
set.add(new test6(3));
for (test6 t: set)
System.out.println(t.count);
}
public boolean equals(Object o)
{
return (this.count== ((test6)o).count);
}
public int hashcode()
{
return count;
}
}
O/P --
5
5
3
Not able to get. Can anyone please explain me this in simple terms. Please...