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();
}
}
'응용 SoftWare > JAVA' 카테고리의 다른 글
| HashSet (0) | 2016.12.14 |
|---|---|
| LinkedList (0) | 2016.12.14 |
| Properties (0) | 2016.12.14 |
| ArrayList (0) | 2016.12.14 |
| [응용] RGB 검색창 (JLabel, JPanel, JSlider) (0) | 2016.12.12 |

