Question

Consider the following Java code snippet:     import java.util.PriorityQueue;     public class HeapQuestion5 {         public static void main(String[] args) {             PriorityQueue pq = new PriorityQueue();             pq.add("apple");             pq.add("banana");             pq.add("cherry");             System.out.println(pq.peek());             System.out.println(pq.size());             System.out.println(pq.peek());         }     }     What will be the output of this program?

A apple, 3, apple
B apple, 2, banana
C banana, 3, banana
D apple, 3, banana
E cherry, 3, cherry
Practice Next

Hey! Ask a query