public Object pop()
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