Driver code
public static void main ( String [ ] args ) { Node head1 = null ; head1 = push ( head1 , 20 ) ; head1 = push ( head1 , 5 ) ; head1 = push ( head1 , 15 ) ; head1 = push ( head1 , 10 ) ; Node head2 = null ; head2 = push ( head2 , 10 ) ; head2 = push ( head2 , 2 ) ; head2 = push ( head2 , 15 ) ; head2 = push ( head2 , 8 ) ; System . out . println ( firstCommon ( head1 , head2 ) ) ; } }