Hyun CHO 2016. 12. 14. 17:00

import java.util.Stack;


public class StackTest {


public StackTest() {

Stack<Integer> stack = new Stack<Integer>();

//데이터 추가

stack.push(new Integer(100));

stack.push(new Integer(200));

stack.push(new Integer(300));

stack.push(new Integer(400));

//Stack 컬렉션의 객체 얻어오기

// empty 스택이 비어있는지 확인 후 객체가 없을 때 true

while(!stack.empty()){

System.out.println(stack.pop()); //pop() : 객체 얻어오기

}

}


public static void main(String[] args) {

new StackTest();


}


}