Download the following classes into your java program directory: CharQueue.class and QueueException.class. Then copy/paste the following program and compile and run it:

//the program demonstrates a stack used to store characters
public class ShowQueue {
	public static void main(String [] args) {
	    // creating a new queue
		CharQueue cq = new CharQueue();
		// a variable to store stack characters
		char c;

		cq.enqueue('a');
		cq.enqueue('b');
		c = cq.dequeue();
		System.out.println("c = " + c);
		cq.enqueue('c');
		cq.enqueue('d');

		while( !cq.isEmpty()) {
		    c = cq.dequeue();
		    System.out.print(c);
		}
		System.out.println(); // new line
	}
}

This is an example from CSci 2101 course.