Java MCQ: Which interface does PriorityQueue implement in Java?
a) Queue
b) List
c) Set
d) Map
Answer:
a) Queue
Explanation:
The PriorityQueue
class in Java implements the Queue
interface. It provides a way to order elements based on their priority and is part of the Java Collections Framework.
Understanding the Queue
interface and its implementations, like PriorityQueue
, is essential for managing collections that follow the first-in, first-out (FIFO) principle or are ordered by priority.
Reference links:
https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html