i need help getting the 'x' value out of an object:
class SortablePointd implements Comparable {
double x, y;
// Constructor:
public SortablePointd (Pointd p, boolean sortByX){
this.x = p.x;
this.y = p.y;
}
public int compareTo (Object obj)
{
// ... Do the comparison based on whether it's by X or Y ...
System.out.println(obj.getClass());
System.out.println(obj.x);
}
}
on the last line, it gives an error because I can't do obj.x? so how would i get the x value in obj?
obj is a SortablePointd btw