Stack in Java

Stack in Java

Stack class represents a last-in-first-out(LIFO) stack of objects. It extends class Vector with five operations that allow a vector to be treated as a stack. When a stack is first created, it contains no items. Creation of Stack using Array and Linked List has been explained here.

In addition to method provided by its base class Vector, Stack provides following methods.

[table “” not found /]

Example of Stack.


Leave a Reply

Your email address will not be published. Required fields are marked *