What is a stack in Java?
A stack is a data structure where elements can be accessed in any order, much like a list.
Actually, in a stack, elements are only accessed in a specific order: the most recently added element is accessed first (LIFO).
Can you explain how the push and pop methods work in a stack?