public class Cmp { public static void show(Integer a,Integer b) { System.out.printf("%d.compareTo(%d) = %d%n",a,b,a.compareTo(b)); // a.compareTo(b) < 0 means a < b // a.compareTo(b) > 0 means a > b // a.compareTo(b) == 0 means a == b } public static void main(String[] args) { show(1,20); show(1,0); show(1,1); } }