public class ListDemo { private static List makeList(String[] strings) { List list = new List(); Node prev = null; for (String s : strings) { Node curr = new Node(); curr.value = s; if (prev != null) prev.next = curr; else list.head = curr; prev = curr; } return list; } public static void main(String[] args) { List list = makeList(args); for (Node i = list.head; i != null; i = i.next) System.out.println(i.value); } } class List { Node head = null; } class Node { public String value = null; public Node next = null; }