/* * This was used in class to show the use of libraries (packages). In * this case the package is "java.util" and the library class we use * is "Vector". */ import java.util.*; public class MyStack { Vector items; public MyStack() { items = new Vector(); } public void push(Object item) { items.addElement(item); } public Object pop() { int size = items.size(); Object obj = items.elementAt (size - 1); items.removeElementAt (size - 1); return obj; } public boolean empty() { return items.isEmpty(); } }