In queues, elements are stored and accessed in First In, First Out manner. That is, elements are added from the behind and removed from the front. In Java, we must import java.util.Queue library in order to use Queues.
Here, we have created objects animal1, animal2 and animal3 of classes LinkedList, ArrayDeque and PriorityQueue respectively. These objects can use the functionality of the Queue interface.