标签:
package 集合类.list类; import java.util.Date; import java.util.Stack; /** * stack类继承与vector类 * @author jjj * */ public class Stack类 { public static void main(String[] args) { Stack s = new Stack(); s.push("hello"); s.push(new Date()); s.push(400); // 自动封装 , 等价于 s.push(new Integer(400)); s.push(3.14); System.out.println(" 弹栈前 :size=" + s.size()); System.out.println(s.pop()); System.out.println(" 弹栈后 :size=" + s.size()); System.out.println(s.peek()); System.out.println("peek 操作后 :size=" + s.size()); while(!s.isEmpty()) System.out.println(s.pop()); } }
标签:
原文地址:http://www.cnblogs.com/hwaggLee/p/4510628.html