Friday, June 30, 2006

[java] Shows stack class

Shows stack class

import java.lang.*;

import java.util.*;

public class StackApp

{

public static void main(String args[])

{

Stack s = new Stack();

s.push("one");

s.push("two");

s.push("three");

System.out.println("Top of the stack: " +s.peek());

while (!s.empty())

System.out.println(s.pop());

}

}

Pradyut
http://pradyut.tk
http://spaces.msn.com/members/oop-edge/
http://groups-beta.google.com/group/oop_programming
India

No comments: