What will be the output of the following code?
import java.util.*;
public class Test {
public static void main(String[] args) {
Queue<Integer> queue = new PriorityQueue<>();
queue.add(30);
queue.add(10);
queue.add(50);
queue.add(20);
System.out.println(queue.poll());
}
}
10
30
50
20
This question is part of this quiz :
Java Queue and Map Interface