import java.util.*;
public class Main {
public static void main(String[] args) {
// Queue q = new Queue();
Queue<Integer> q = new LinkedList<>(); // or ArrayDeque, because we can't make a object using Queue, queue is an interface
q.add(1);
q.add(2);
q.add(3);
while(!q.isEmpty()) {
System.out.println(q.peek());
q.remove();
}
}
}
No comments:
Post a Comment