public class testing{ public class node implements Comparable{ int data; public node(int data){ this.data = data; } @Override public int compareTo(node n){ return data - n.data; } } public static void main(String[] args) { testing t = new testing(); node n1 = t.new node(5); node n2 = t.new node(10); System.out.println(n1.compareTo(n2)); } }