15 lines
346 B
Java
15 lines
346 B
Java
//: holding/StackTest.java
|
|
import net.mindview.util.*;
|
|
|
|
public class StackTest {
|
|
public static void main(String[] args) {
|
|
Stack<String> stack = new Stack<>();
|
|
for(String s : "My dog has fleas".split(" "))
|
|
stack.push(s);
|
|
while(!stack.empty())
|
|
System.out.print(stack.pop() + " ");
|
|
}
|
|
} /* Output:
|
|
fleas has dog My
|
|
*///:~
|