Implemented compareTo(Obj x) and overrode equals(Obj x)