title: myArraylist.size() cannot find symbol error Java
body: <p>I made a stack using java generics in order to make a program that calculates a mathematical expression.</p>
  
  <p>Here is the code of the stack:</p>
  
  <pre><code>import java.util.ArrayList;   
  public class Stack&lt;T&gt; 
      {
      private ArrayList&lt;T&gt; stack;
  
      public Stack()
      {
          stack = new ArrayList&lt;T&gt;();
      }
  
      public void push(T item)
      {
          stack.add(item);
          System.out.println(item);
      }
  
      public T pop()
      {
          T last;
          last = stack.remove((stack.size() - 1));
          System.out.println(last);
          return(last);
      }
  
      public boolean isEmpty() 
      {  
          return stack.isEmpty();
      }
  }
  </code></pre>
  
  <p>but when i try to do:</p>
  
  <pre><code> Stack&lt;Integer&gt; number = new Stack&lt;Integer&gt;();
  </code></pre>
  
  <p>in another class which calculates the expression</p>
  
  <p>and then use it to do the following:</p>
  
  <pre><code>if(number.size()&gt;=2)
  {
      //calculation
  }
  </code></pre>
  
  <p>since i have an ArrayList , i get error:canot find symbol in number.size() , can you help me?</p>