Many structures are built into a standard Java
libraries, so we can just call them.
The queue is typical example:
public static void main(String[] args) { Scanner sc = new Scanner(System.in); Queue qq = new Queue(); qq.addLast(5); qq.addLast(7); qq.addLast(3); //==================================================== int x; do { System.out.println(qq.toString()); System.out.print("1-add,2-erase,9-end: "); x = sc.nextInt(); if (x==1) { System.out.print("Enter value: "); int i = sc.nextInt(); qq.addLast(i); System.out.println(); } if (x==2) { int i = qq.deteteFirst(); System.out.print("Erased value: "); System.out.println(i); } } while (x != 9); System.out.print("Exiting."); } }