/* Write a simple application program that use the utility queue to: 1) insert five elements (10,20,30,40,50) 2) remove from queue two elements 3) display elements in the queue */ public class Main { public static void main(String[] args) { QueueClass theQueue = new QueueClass(5); theQueue.insert(10); theQueue.insert(20); theQueue.insert(30); theQueue.insert(40); theQueue.insert(50); theQueue.remove(); theQueue.remove(); // display elements in the queue while (!theQueue.isEmpty()) { int elements = theQueue.remove(); System.out.print(elements); System.out.print(" "); } } } // Output : 30 40 50
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter