// AddSingle.java class LinkedList { // a Node of the list private class Node { public Type data; public Node next; } // the head of the list is first node private Node head; // the list starts empty public LinkedList() { head = null; } // add an item to the list public void add(Type item) { Node newNode = new Node(); newNode.data = item; newNode.next = head; head = newNode; } // add an item to the end of the list public void append(Type item) { // if the list is empty, add it to the start instead if (head == null) { add(item); } else { // make the new node Node newNode = new Node(); newNode.data = item; newNode.next = null; // find the last node in the list Node last = head; while (last.next != null) { last = last.next; } // append the new node to the last one last.next = newNode; } } // print the list from start to finsih public void print() { Node current = head; while (current != null) { System.out.println(current.data); current = current.next; } } } public class AddSingle { public static void main(String args[]) { // make the list LinkedList list = new LinkedList(); // add some nodes at the end for (int i = 1; i <= Integer.parseInt(args[0]); i++) { list.append(i * 10); } } }