Java语言中自己有Stack的实现方法
http://docs.oracle.com/javase/7/docs/api/java/util/Stack.html
我自己写了一个代码
import java.util.Stack;
public class StackTest
{
@SuppressWarnings("unchecked")
public static void main(String[] args)
{
Stack A=new Stack();
System.out.println(A.empty());
A.push(1);
A.push(2);
A.push(3);
System.out.println(A.pop());
System.out.println(A.pop());
System.out.println(A.peek());
System.out.println(A.empty());
}
}