QueueApp.java

import java.awt.Color;

class QueueApp {

    static public void main(String[] args) {
	final int length=5;

	Queue f = new ArrayQueue(length);

	//Add some objects with different types
	f.insert(new Integer(1));
	f.insert(new Float(2f));
	f.insert(new Double(3.0));
	f.insert("four");
	f.insert( new Color(0,255,0));

	System.out.println("Length = " + f.getLength());

	//Remove objects from the queue and print them out
	for (int i=0; i<length; i++) {
	    System.out.print(f.remove());
	    System.out.println("  length is now " + f.getLength());
	}

	// See what happens if we try to remove one more object than 
        // there is in the Queue
	System.out.println(f.remove());
    }
}


Generated by GNU enscript 1.6.3.