Java(四)集合框架2.stack类

public class StackDemo {
	public static void main(String[] args)
	{
		Stack s1=new Stack();
		s1.push("C");
		s1.push("B");
		s1.push("A");
		System.out.println(s1);
		System.out.println(s1.peek());
		s1.pop();
		System.out.println(s1.peek());
	}
}

在这里插入图片描述
stack堆栈类,后进先出

猜你喜欢

转载自blog.csdn.net/qq_37282683/article/details/82913389
今日推荐