栈-后进先出-java

import java.util.Stack;

/**
 * Created by yywang on 2017/1/14.
 */
public class f {

    public static void main(String[] args) {
        Stack<Integer> s = new Stack<Integer>();

        for (int i = 0; i < 6; i++) {
            s.push(i);
        }
        for (int i : s
                ) {
            System.out.println(i);
        }
        System.out.println();
        while(!s.empty()){
            System.out.println(s.pop());
        }
    }
}

栈用例
1,算术表达式求值
http://blog.csdn.net/u012063703/article/details/54427493

展开阅读全文

没有更多推荐了,返回首页