public class TabPile implements Pile {

    int size;
    int[] tab;

    public TabPile(int sz) {
        this.size = 0;
        this.tab = new int[sz];
    };
    public TabPile() { this(16); }  // délégation de constructeur

    @Override
    public void push(int n) {
        this.tab[this.size++] = n;
    }

    @Override
    public int pop() {
        return this.tab[--this.size];
    }

    @Override
    public int peek() {
        return this.tab[this.size - 1];
    }

    @Override
    public boolean isEmpty() { return this.size == 0;
    }

    @Override
    public int size() { return this.size; }
}
