What happens when you pop from an empty stack while implementing using the Stack ADT in Java?
A. Undefined error
B. Compiler displays a warning
C. EmptyStackException is thrown
D. NoStackException is thrown
Answer:C
What happens when you pop from an empty stack while implementing using the Stack ADT in Java?
A. Undefined error B. Compiler displays a warning C. EmptyStackException is thrown D. NoStackException is thrown
Explanation: The Stack ADT throws an EmptyStackException if the stack is empty and a pop() operation is tried on it.