1: public T peek() 2: { 3: checkInitialization(); 4: if (isEmpty()) 5: throw new EmptyStackException(); 6: else 7: return stack.lastElement(); 8: } // end peek 9: // Version 4.0