What is a stack?
A stack is a data structure that supports LAST IN FIRST OUT methodology. The element pushed last is at the top of the stack. A stack supports the following functionality:
Push-operation to push an element into the stack
Pop-operation to push an element out of the stack
Peek-An option to check the top element
🔗Reference: stackoverflow.com
🔗Source: Java Interview Questions and Answers