The Queue follows the FIFO principle, it means First In First Out which works as the first
added element to the Queue collection is available to remove first. It is like the items place in
an open-ended pipe.
It has the following methods:
- Enqueue() method to add the elements
- Dequeue () method to remove the elements
- Peek () method to read the last element.
Example 2: Queue collection adding and removing the element.
The output will be: