
public class Quiz08 {

  /** Reverses the elements stored in the given Queue. */
  public static <E> void reverse(Queue<E> q) {

    //...your code here...

  }

  /** Demonstrates the reverse method in action. */
  public static void main(String[] args) {
    Queue<String> q = new Queue<>();
    for (String s : new String[]{"A", "B", "C", "D"}) {
      q.offer(s);
    }
    System.out.println(q);  // [A, B, C, D]
    reverse(q);
    System.out.println(q);  // [D, C, B, A]
  }
}
