iManage interview question

How does a stack in Java work?