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 }
原文地址:https://www.cnblogs.com/vector11248/p/7736197.html