pop() Method

To remove an element from the top of the stack, we use the pop() method. For example,


\begin{lstlisting}
import java.util.Stack;
\par
class Main {
public static void...
...p();
System.out.println(''Removed Element: '' + element);
}
}
\end{lstlisting}