You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
458 B
Java

Stack Demo
import java.util.Stack;
public class StackDemo
{
public static void main(String args[])
{
Stack lifo=new Stack();
for(int i=1; i<=20; i++)
{
lifo.push (new Integer(i) );
}
while(!lifo.empty())
{
System.out.print(lifo.pop());
System.out.print(',');
}
System.out.println("LIFT-OFF");
}
}