If you just want to check if the object is different to another object, then you need to override the Object.equals() method in your class.
If you want to use the comparison for sorting your objects, then you need your class to implement the
Comparable interface.
Have a go at that and if you have any problems, come back and show us your code.