![]() |
VOOZH | about |
public E remove()Parameters: This method does not accept any parameters. Returns: The method returns the head of the Queue. Exception: The function throws an NoSuchElementException if the queue is empty. Below programs illustrate remove() method: Program 1:
AbstractQueue1 contains : [10, 20, 30, 40, 50] head : 10 AbstractQueue1 after removal of head : [20, 30, 40, 50]
AbstractQueue1 contains : [10] head : 10 Exception: java.util.NoSuchElementException