Skip to main content

Stack in java

import java.util.*;
import java.io.*;
class a
{
public static void main(String args[])throws Exception
{
Stack s =new Stack();
System.out.println("Empty= "+s.empty());

s.push("1");
s.push("2");
s.push("3");
System.out.println(s);
System.out.println(s.search("0"));
System.out.println(s.search("1"));
System.out.println(s.search("2"));
s.pop();
System.out.println(s);
System.out.println(s.peek());
}
}

Comments

Popular posts from this blog

unix commands