Stack implementation with exceptions
Your stack returns 0 instead of 3 on this simple case:

public static void main(String[] args) {
    Stack2 s = new Stack2();
    s.add(3);
    System.out.println(s.pop());
}


Traditionally, the stack operations are called "push" and "pop".  It's unusual to have "add" and "pop".

The isEmpty() method would be better written as:

public boolean isEmpty(){
    return size == 0
}


Throwing ArrayIndexOutOfBoundsException would be worse, since it would result in a "leaky" abstraction.  The user shouldn't know that the stack is actually backed by an array.