title: Need some assistance with java stacks
body: <p>Have to say i'm a total newbie to java. recently i'm studying implementing data structures using java for an exam. while going through array based stacks i found below code.</p>
  
  <pre><code>    class StackX {
  
      private int maxSize;        // size of stack array
      private long[] stackArray;
      private int top;            // top of stack
  
     //-------------------------------------------------------------
  
      public StackX(int s)         // constructor
      {
      maxSize = s;             // set array size
      stackArray = new long[maxSize];  // create array
      top = -1;                // no items yet
      }
  
  
     //-------------------------------------------------------------
     public void push(long j)    // put item on top of stack
     {
     stackArray[++top] = j;     // increment top, insert item
     }
  </code></pre>
  
  <p>i have an idea about what first three lines for, but i'm troubled at understanding below lines. </p>
  
  <pre><code>     maxSize = s;             // set array size
  
       stackArray = new long[maxSize];  // create array
  
       top = -1;                // no items yet
  </code></pre>
  
  <p>Can someone explain why the use of <strong>[maxSize]</strong> in a array which is data type of <strong>long</strong>? shouldn't it be numeric since the data type is long.</p>
  
  <p>also why use <strong>long j</strong> on push(long j) there's no variable associated with j.</p>
  
  <p>Help &amp; comments are appreciated. </p>