Java Stack 栈

Java Stack 栈

package com.ssm.cts.test;

import java.util.Enumeration;
import java.util.Stack;
import java.util.Vector;

public class ClassTest {
    // 测试
  public static void main(String[] args) {
    Stack<Integer> st = new Stack<Integer>();
    st.push(new Integer(1));
    st.push(new Integer(2));
    st.push(new Integer(3));
    
    st.pop();
    
    for (int i = st.size() - 1; i >= 0; i--) {
      System.out.println(st.get(i).toString());
    }
    
  }
}

 

发表回复

您的电子邮箱地址不会被公开。