Home » JAVA Programming » Data Structures » Question
  1. What is difference between dequeue() and peek() function of java?
    1. peek() removes and returns the next item in line while dequeue() returns the next item in line
    2. dequeue() removes and returns the next item in line while peek() returns the next item in line
    3. dequeue() and peek() return the next item in line
    4. dequeue() and peek() remove and return the next time in line
    5. None of these
Correct Option: B

dequeue() removes the item next in line. peek() returns the item without removing it from the queue.



Your comments will be displayed only after manual approval.