156k views
1 vote
The java class library interface queue method tagg retrieves the entey at the front of a queue but themrows a NosuchElementException if the queue was empty is

A.poke

B.empty

C.look

D.peek

1 Answer

6 votes

Answer:D) peek

Step-by-step explanation:Peek operation or function is the method that is used for the returning of the values on the front of the queue or stack type datatypes. This operation function over those datatypes having group or collection of the elements and does not eliminate any element from the queue.

NOsuchElemnet exception is shown when there is the peek operation in the queue for the element to be displayed on the top and no deletion can take place .Thus, the correct option is option(D).

User RoyalSwish
by
5.5k points