Stack Push and Pop-Java

import java.util.Stack;

public class String3 {

public static void main(String[] args) {

Stack st=new Stack();

st.push(10);

st.push(20);

System.out.println(“Size of stack is “+st.size());

System.out.println(“Let me display this “);

System.out.println(“First element of stack is “+st.firstElement());

System.out.println(“Remove top object “+st.pop());

}

}

Advertisements

About qainterviews

Software Geek,QA Expert,Blogger
This entry was posted in Java, Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s