I have a doubt that can we use ArrayList as a dynamic stack?

I have a doubt that can we use ArrayList as a dynamic stack??

see this: