title: write a simple program to use stack
body: <p>I'm trying to write a simple program to use stack in it
  I have written a class which defines methods:</p>
  
  <pre><code>    public interface Stack&lt;E&gt;{
           public int size();
  
          public boolean isEmpty();
  
         public E top();
  
        public void push(E element);
        public E pop()throws EmptyStackException;
    }
  </code></pre>
  
  <p>and another class for implementing Stack:</p>
  
  <pre><code>    public abstract class myStack&lt;E&gt; implements Stack&lt;E&gt;{
  
  private final E s[];
  int t=0;
  
  public myStack() {
      this.s = (E[]) new Object[100];
  }
  
  
  @Override
  public int size(){
      return t;
  }
  
  
  @Override
  public boolean isEmpty(){
      switch(size()){
          case 0:
              return true;
      }
      return false;
  }
  
  
  @Override
  public E top() {
      if(isEmpty())
          throw new EmptyStackException();
      return s[t-1];
  }
  
  @Override
  public void push(E element) {
      if(isEmpty())
          s[0]= element;
      else
          s[t]= element;
      t++;
  }
  
  
  @Override
  public E pop() {
              E x;
      if(isEmpty())
          throw new EmptyStackException();
      else{
          x = s[t-1];
          s[t-1] = null;
          t--;
      }
      return x;
  }
  }
  </code></pre>
  
  <p>for testing these code I have written another class that contains main():</p>
  
  <pre><code>   public static void main(String[] args) {
      // TODO code application logic here
  
      Stack&lt;Integer&gt; s;
      s.push(1);
      s.push(2);
      System.out.println(s.pop());
  }
  </code></pre>
  
  <p>but when I run the program it gives me this Error "Exception in thread "main" java.lang.RuntimeException"</p>
  
  <p>I have checked this program several times but I really can't understand what is the problem </p>
  
  <p>can anyone please help me??
  thanks for your attention in advance</p>