import net.datastructures.Node; public class list { public static void main(String[] args ) { int i; Node head1, tail1, head2, tail2, temp; Node head3, tail3; /***** Creating list 1 ********/ Node u = new Node(0, null); head1=u; tail1=u; for (i=1; i<=10; i++) { temp = new Node(i, null); tail1.setNext(temp); tail1=temp; } /*** print list 1 */ temp=head1; while (temp != null) { System.out.println("PPp"+temp.getElement()); temp=temp.getNext(); } /***** Creating list 2 ********/ temp = new Node(100, null); head2=temp; tail2=temp; for (i=11; i<=20; i++) { temp = new Node(i, null); tail2.setNext(temp); tail2=temp; } /*** print list 2 */ temp=head2; while (temp != null) { System.out.println("PPp"+temp.getElement()); temp=temp.getNext(); } /* merge list1 and list2 into a list called list3 */ head3=head1; tail1.setNext(head2); tail3=tail2; /* print out list 3 */ System.out.println(" "); temp=head3; while (temp != null) { System.out.println("P33P"+temp.getElement()); temp=temp.getNext(); } } }