Code import java.util.*; class MyStack { private Vector v; public MyStack() { v = new Vector(); } public void clear() { v.clear(); } public void push(int n) { v.addElement(n); } public int pop() throws MyStackException { int n = peek(); v.removeElementAt(v.size()-1); return n; } public int peek() throws MyStackException { if (isEmpty()) throw new MyStackException("Stack empty"); else return ((Integer)(v.lastElement())).intValue(); } public boolean isEmpty() { return v.isEmpty(); } public void print() { System.out.println(v.toString()); } } class MyStackException extends Exception { public MyStackException() {} public MyStackException(String msg) { super(msg); } }