Code example for EmptyStackException

0
	} 
 
	@Override 
	public E peek() throws EmptyStackException { 
		if (isEmpty()) 
			throw new EmptyStackException();
		else  
			return elements.getFirst();
	} 
 
	@Override 
	public void push(E e) {
		elements.addFirst(e);
	} 
 
	@Override 
	public E pop() throws EmptyStackException { 
		if (isEmpty()) 
			throw new EmptyStackException();
		else  
			return elements.removeFirst();