/** * List Data structure * * Debugging problem: mkList has a problem. */ class Node { private Object item; private Node next; // constructors Node() { this(null,null); } public Node(Object e, Node n){ item=e; next=n; } // methods public void setItem(Object i){item = i; } public void setItem(Node n) { item = n.getItem(); } public void setNext(Node n) { next = n; } public Node getNext() { return next; } public Object getItem() { return item; } public void printItem() { System.out.println(item.toString());} // extra methods public static Node mkList(String[] L) { Node n = null; int i = L.length; while (i>0); { i--; n = new Node(L[i],n); } return n; } public void print() { Node n = next; printItem(); if (n != null) n.print(); } // main public static void main(String args[]) { String[] L = {"abc", "def", "123"}; for (int i=0; i>> Now, the program hangs up..."); System.out.println(">>> Type Control-C to kill program"); Node N = mkList(L); N.print(); } }