public class CompareObjects { public static void main (String []args) { try { Point p = new Point(1,1); Rectangle rec1 = new Rectangle(10, 20, p); Rectangle rec2 = new Rectangle(10, 22, p); System.out.println("Larger objet is "+ MyComparableUtil.findLarger(rec1, rec2)); } catch(InvalidComparableTypeException ex) { System.err.println("Unable to compare objects!"); } } }