📅  最后修改于: 2020-11-14 06:24:42             🧑  作者: Mango
java.util.Stack类表示对象的后进先出(LIFO)堆栈。
首次创建堆栈时,它不包含任何项目。
在此类中,将首先访问最后插入的元素。
以下是java.util.Stack类的声明-
public class Stack
extends Vector
Sr.No. | Constructor & Description |
---|---|
1 |
Stack() This constructor creates an empty stack. |
Sr.No. | Method & Description |
---|---|
1 | boolean empty()
This method tests if this stack is empty. |
2 | E peek()
This method looks at the object at the top of this stack without removing it from the stack. |
3 | E pop()
This method removes the object at the top of this stack and returns that object as the value of this function. |
4 | E push(E item)
This method pushes an item onto the top of this stack. |
5 | int search(Object o)
This method returns the 1-based position where an object is on this stack. |
此类从以下类继承方法-