// enter numbers into a linked list // add on to end then print them out import java.io.*; public class test3 {public static input in = new input(); public static void main(String[] args) throws IOException {int num = -1; ListNode front = null,last=null; System.out.print("Enter a number "); num = in.getInt(); while (num > 0) {ListNode n = new ListNode(new Integer(num),null); if (front == null) {front = n; last = n; } else {last.setNext(n); last = n; } System.out.print("Enter a number "); num = in.getInt(); } // print out ListNode curr = front; while (curr != null) {System.out.println(curr.getValue()); curr= curr.getNext(); } } }