title: Constructors with the same primitive type as parameter
body: <p>I have an assignment that asks me to create a Data Class as a &quot;Node Center&quot; for all my other classes, such as a class for LinkedList, Stack, &amp; Queue to &quot;feed&quot; on. I'm creating constructors in the Data class to work on the LinkedList, Stack, &amp; Queue classes. I wasn't having any problems until I implemented my constructor for my Queue. In my Stack portion of the Data class, I had already created a public Data constructor with an int as my parameter in the constructor. When I try to create another public Data constructor with an int as my parameter for the Queue, I get the error: Data(int) is already defined in Data. Here is my Stack code:</p>
  <pre class="lang-java prettyprint-override"><code>/*
      STACK WITH AN ARRAY
      */
      int size; //initialize size
      int stackArray[]; //initialize array
      int top; //initialize top
  
      public Data(int size) //constructor
      {
          this.size = size;
          this.stackArray = new int[size];
          this.top = -1;
      }
  </code></pre>
  <p>And here is my Queue code:</p>
  <pre class="lang-java prettyprint-override"><code>/*
      QUEUE WITH AN ARRAY
      */
      public int Queue[]; //establish queue array and variables
      public int front;
      public  int rear;
      public int queueSize;
      public int len;
  
      public Data(int nQueue)//constructor
      {
          size =nQueue;
          len = 0;
          Queue = new int[size];
          front = -1;
          rear = -1;
      }
  </code></pre>
  <p>How do I fix this so I can have 2 constructors with the same parameter type?</p>