Multiple choice

Which of the following methods in stack class java returns the element on the top of the stack, but does not remove it?

  1. empty()

  2. peek()

  3. pop()

  4. none of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This method in stack class java returns the element on the top of the stack but does not remove it.