Code example for EmptyStackException

0
 
    public Object pop()
    { 
        if (empty()) 
        { 
            throw new EmptyStackException();
        } 
 
        return elements.removeLast();
    } 
 
    public Object peek()
    { 
        if (empty()) 
        { 
            throw new EmptyStackException();
        } 
 
        return elements.getLast();
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE