?? testqueue.java
字號:
/** * Title: TestQueue2.java * Description: A test drive program for the Queue class * Used SimpleInput class methods for inputs */import miscLib.SimpleInput;import miscLib.GenLib;public class TestQueue { public static void main(String[] args) { ListQueue q = new ListQueue();// ArrayQueue q = new ArrayQueue(20); byte barray[] = new byte[20]; int n; do { n = SimpleInput.getInteger("How many to enqueue? "); for (int i = 0; i < n; i++) { q.enqueue(new Integer(GenLib.genInt(1, 100))); System.out.println(q); } n = SimpleInput.getInteger("How many to dequeue? "); for (int i = 0; i < n; i++) { if (q.empty()) { System.out.println("Queue is now empty, dequeue ignored."); break; } else { System.out.println("dequeued:"+q.dequeue()); System.out.println(q); } } } while (SimpleInput.getChar("more (y/n)? ") == 'y'); System.out.println("Bye now."); System.exit(0); }} // class TestQueue
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -