Hi all,
When I run use to add second element in the tree set it shows java.lang.ClassCastException: could any one explain me why
import java.util.TreeSet;
public class Venus {
public String str;
public static void main(String[] args) {
Venus a =new Venus();
Venus b= new Venus();
a.str="obj1";
b.str="obj2";
TreeSet<Venus> set =new TreeSet<Venus>();
set.add(a);
set.add(b);
System.out.println(set.size());
}
}