class PairTest { public static boolean inOrder(Comparable a, Object b) { // "Comparable" ensures we have the compareTo method return a.compareTo(b) < 0; } public static void main(String[] args) { Pair p1 = new Pair(3.0, 4.0); Pair p2 = new Pair(3.0, 5.0); System.out.println( p1.compareTo(p2) ); // System.out.println( p1.compareTo("abcd") ); System.out.println( inOrder(p1, p2) ); } }