I need an example on queue implementation in java

You can use LinkedList or Stack:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/LinkedList.html
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Stack.html

LinkedList<String> fifo = new LinkedList<String>();
fifo.add("First");
fifo.add("Second");
fifo.add("Last");
	
System.out.println(fifo.poll());
System.out.println(fifo.poll());
System.out.println(fifo.poll());
		
Stack<String> lifo = new Stack<String>();
lifo.add("First");
lifo.add("Second");
lifo.add("Last");
		
System.out.println(lifo.pop());
System.out.println(lifo.pop());
System.out.println(lifo.pop());

gives:

First
Second
Last
Last
Second
First

Or did you want to implement one yourself?

A queue implementation, if you wanted to write it yourself, is simple enough that you could just start coding if you know what a queue is, so I'm thinking maybe you have a more specific question, a part of the queue implementation or a concept you don't understand?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.