KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > NotEmpty


1 import java.util.*;
2 public class NotEmpty {
3     
4     public static void main (String JavaDoc [] args) {
5         NotEmpty ne = new NotEmpty();
6         ne.run();
7     }
8     
9     private void run(){
10         Stack s = new Stack();
11
12         s.push("J");
13         s.push("E");
14         s.push("N");
15         s.push("N");
16         s.push("N");
17         s.push("N");
18         s.push("N");
19         s.push("N");
20
21         while (!s.isEmpty()) {
22             System.out.println(s.pop());
23         }
24     }
25 }
26
Popular Tags