public class ListMain { public static List makeList() { List h = null; List p; p = new List(); p.value = 55; p.next = h; h = p; p = new List(); p.value = 44; p.next = h; h = p; p = new List(); p.value = 33; p.next = h; h = p; p = new List(); p.value = 22; p.next = h; h = p; p = new List(); p.value = 11; p.next = h; h = p; return h; } public static void main(String[] args) { List head = makeList(); // initial list and make head point to first // element in the list List ptr; ptr = head; while ( ptr != null ) { System.out.println( ptr.value ); // Access the "value" component ptr = ptr.next; // Access the "next" component } } }