-
What is difference between dequeue() and peek() function of java?
-
- peek() removes and returns the next item in line while dequeue() returns the next item in line
- dequeue() removes and returns the next item in line while peek() returns the next item in line
- dequeue() and peek() return the next item in line
- dequeue() and peek() remove and return the next time in line
- None of these
Correct Option: B
dequeue() removes the item next in line. peek() returns the item without removing it from the queue.