title: How can I set length of array to field value in the same class?
body: <p>I made the the field value maxSeats as to represent the number of max seat that will be in the main class like this.
  Main Class: </p>
  
  <pre><code>public static void main(String[] args) {
      Student a = new Student("Abigail", 1, 5);
      Student b = new Student("Benny", 1, 6);
      Student c = new Student("Charles", 1, 10);
      Student d = new Student("Denise", 2, 12);
      Student e = new Student("Eleanor", 2, 9);
      Student f = new Student("Fred", 2, 5); 
  
      SchoolBus sb1 = new SchoolBus(3, 1);
      SchoolBus sb2 = new SchoolBus(3, 2);
      sb1.getRemainSeat();
      sb1.addStudent("Benny", 1, 6);
  }
  </code></pre>
  
  <p>Other class:</p>
  
  <pre><code>private int maxSeats;
  private int routeNum;
  String[] studentArray = new String[3];
  public SchoolBus(int mS, int rN){
      mS = maxSeats;
      rN = routeNum;
  }
  </code></pre>
  
  <p>And I want the field studentArray to have the length of the maxSeats, but it seems that this sets the length of array to 0, and I get outofboudary error.  Is there any way to properly set the length of array to the field value in the same class?</p>