栈
@Test
public void test5() {
Stack<Integer> stack = new Stack<Integer>();
stack.push(1);
stack.push(2);
int result = stack.pop();
System.out.println("出栈的是: " + result);
System.out.println("栈中仍存在的元素为 " + stack);
stack.push(3);
result = stack.peek();//查看堆栈顶部的对象,但不从堆栈中移除它
System.out.println("栈堆顶部的对象是: " + result);//3
boolean flag = stack.empty();
System.out.println("stack是否为空: " + flag);
int location = stack.search(1);
System.out.println("栈中1的位置为: " + location);
}