Few comments:
The name
StackMethodsis not the best name for this, you should rather pick a name that describes your entity, eg:StackYour class only works for integers, where Stack is an
ADTthat should accept various types, so consider usinggenericsinsteadclass Stack<T>{ private T[] stackArray; }the fields :
size, andstackhavepackage access, and this means classes within the same package can modify them, declare them asprivateinstead.You should throw an unchecked exception in
pushmethod if the stack is full rather than printing something to the console