9. 13. 3. Removing Elements: To remove an element from the stack, the pop() method |
|
|
Taking the element at the top of the stack, removes it, and returns it. |
If the stack is empty when called, you will get the runtime EmptyStackException thrown. |
import java.util.Stack;
public class MainClass {
public static void main (String args[]) {
Stack s = new Stack();
s.push("A");
s.push("B");
s.push("C");
System.out.println(s.pop());
}
}
|
|
C |