/* TestQueue1.java CIS 160 David Klick 2009-12-01 Demonstration of Queue interface. */ import java.util.LinkedList; import java.util.Queue; public class TestQueue1 { public static void main(String[] args) { Queue stack = new LinkedList(); // Add 10 through 1 to queue long n = 10L; while (n > 0) stack.add(n--); // Remove each item from queue and get product of them all long result = 1L; while (!stack.isEmpty()) result *= stack.remove(); // The result should be 10! (362880) System.out.println(result); } } /* Sample run: 3628800 */