List of usage examples for java.util Stack Stack
public Stack()
From source file:MainClass.java
public static void main(String args[]) { Stack s = new Stack(); s.push("A");//from w w w . ja va 2 s . c o m s.push("B"); s.push("C"); System.out.println("Next: " + s.peek()); }
From source file:MainClass.java
public static void main(String args[]) { Stack s = new Stack(); s.push("A");/*from ww w . j av a 2 s . com*/ s.push("B"); s.push("C"); System.out.println(s); }
From source file:Main.java
public static void main(String args[]) { Stack st = new Stack(); st.push("Java"); st.push("Source"); st.push("from java2s.com"); System.out.println(st.search("Source")); }
From source file:MainClass.java
public static void main(String args[]) { Stack s = new Stack(); s.push("A");/*from w w w . j a v a 2 s.c o m*/ s.push("B"); s.push("C"); System.out.println(s.pop()); }
From source file:MainClass.java
public static void main(String args[]) { Stack s = new Stack(); s.push("A");//from www.j a va 2 s . co m s.push("B"); s.push("C"); System.out.println(s.pop()); System.out.println(s.empty()); }
From source file:Main.java
public static void main(String args[]) { Stack<String> s = new Stack<String>(); s.push("A");/* ww w .j a v a2 s . c om*/ s.push("B"); s.push("C"); System.out.println("Next: " + s.peek()); }
From source file:Main.java
public static void main(String args[]) { Stack st = new Stack(); st.push("Java"); st.push("Source"); st.push("from java2s.com"); // checking the top object System.out.println("Top object is: " + st.peek()); }
From source file:Main.java
public static void main(String args[]) { Stack st = new Stack(); // populating stack st.push("Java"); st.push("Source"); st.push("from java2s.com"); System.out.println("Is stack empty: " + st.empty()); }
From source file:Main.java
public static void main(String args[]) { Stack st = new Stack(); st.push("Java"); st.push("Source"); st.push("from java2s.com"); // checking elements System.out.println("Elements in the stack: " + st); }
From source file:Main.java
public static void main(String args[]) { Stack<String> s = new Stack<String>(); s.push("A");/*from w w w. ja v a 2 s . c o m*/ s.push("B"); s.push("C"); System.out.println(s.pop()); System.out.println(s.empty()); }