OnJava8-Examples/holding/StackTest.java

15 lines
346 B
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: holding/StackTest.java
import net.mindview.util.*;
public class StackTest {
public static void main(String[] args) {
2015-05-05 11:20:13 -07:00
Stack<String> stack = new Stack<>();
2015-04-20 15:36:01 -07:00
for(String s : "My dog has fleas".split(" "))
stack.push(s);
while(!stack.empty())
System.out.print(stack.pop() + " ");
}
} /* Output:
fleas has dog My
*///:~