1.构造函数
Stack只有一个默认构造函数:
Stack()
Stack<Integer> stack = new Stack<Integer>();
2.常用api
(1)入栈:push()
(2)取出栈顶元素,不执行删除:peek()
(3)出栈(删除栈顶元素):pop()
(4)判断栈是否为空:isEmpty(),返回值为boolean
1.构造函数
Stack只有一个默认构造函数:
Stack()
Stack<Integer> stack = new Stack<Integer>();
2.常用api
(1)入栈:push()
(2)取出栈顶元素,不执行删除:peek()
(3)出栈(删除栈顶元素):pop()
(4)判断栈是否为空:isEmpty(),返回值为boolean