java stack

 1 import java.util.*;
 2 
 3 public class AddingGroups {
 4 
 5     public static void main(String[] args) {
 6         Stack<String> stack = new Stack<String>();
 7         
 8         /*不能向stack当中push一个数组
 9         String[] s = {"Ni","Hao"};
10         stack.push(s);*/
11          stack.push("hello");
12         stack.push("world");
13         while(!stack.empty())
14         {
15             System.out.println(stack.pop());
16         }
17 
18     }
19 }

 

posted @ 2017-10-26 12:40  vector11248  阅读(87)  评论(0编辑  收藏  举报