Untitled Document

Subscribe here to get updates on new Videos

 

22. Stack class details (Collection Framework)?

 

 

 

previous homenext

1. It is a child class of Vector.
2. It is Specially designed class for Last in First Out order(LIFO)


Constructor of Stack:

Stack s=new Stack();

Methods in Stack:


1. Object push(Object obj);

For inserting an object to the stack.

2. Object pop():

TO removes and returns top of the stack.

3. Object peak();

To Returns the top of the stack without removal of object.

4. int search(Object obj);

if the specified object is available it returns its offset from top of the statck.
If the object is not available then it returns -1
.

5. Object pop();

For inserting an object to the stack

.