Skip to content

Instantly share code, notes, and snippets.

@shreezan123
Created February 23, 2017 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shreezan123/3c07976f1107cbcd8a965d952c5b8bcc to your computer and use it in GitHub Desktop.
Save shreezan123/3c07976f1107cbcd8a965d952c5b8bcc to your computer and use it in GitHub Desktop.
package Driver;
import howard.edu.ood.hw2.collections.ArrayQueue;
public class Main_Queue {
public static void main(String args[]){
ArrayQueue myqueue = new ArrayQueue(10);
//to enqueue elements onto the stack
for (int i = 0; i<20;i++){
myqueue.enqueue(i*10);
}
//Printing elements after enqueueing
System.out.println("Queue after enqueueing 20 items to it");
System.out.println(myqueue.toString());
//to dequeue elements from the stack
System.out.println("Dequeueing following items: ");
for (int i = 0; i< 5; i++){
System.out.println(myqueue.dequeue());
}
//Printing elements after dequeueing
System.out.println("Queue after 5 items being dequeued");
System.out.println(myqueue.toString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment