![]() |
VOOZH | about |
public E element()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 element() method: Program 1:
AbstractQueue1 contains : [10, 20, 30, 40, 50] head : 10
Exception isjava.util.NoSuchElementException