In Java, a Queue is a data structure that follows the "first in, first out" (FIFO) principle, meaning that the first element that is added to the queue is the first one to be removed. To use a Queue in Java, you first need to import the Queue interface from the java.util package.
This code creates a Queue of Strings using the LinkedList class, adds three elements to the queue, gets the first element without removing it using the peek() method, removes the first element using the remove() method, and then prints the first and removed elements.