title: How to add an object to an array without copy constructor by implementing aggregation
body: <p>I have class Student and  I want to add Student object to the array Student in class Application by using aggregation  </p>
  
  <pre><code>public class Student {//Start class 
  
  private String name; 
  private int id; 
  private double gpa; 
  
  
  public Student(String name, int id, double gpa){  
  this.name=name; 
  this.id=id; 
  this.gpa=gpa; 
  }//End class 
  </code></pre>
  
  <p>Since I don't have a constructor that takes Student object as parameters  I used the getters that I already have in class Student. 
  the problem my code only works with compassion
  if you guys can tell me the right way to add it without making a new copy I would really appreciate it.</p>
  
  <pre><code> public class Application {//Start class Application
  
      private Student[] studentList; 
      private int numOfStudent; 
  
      public Application (int size) {
      studentList= new Student[size]; }
  
      public void addStudent(Student s){
      if(numOfStudent&lt;studentList.length){
  
      studentList[numOfStudent++]=new Student(s.getName(),s.getID(),s.getGpa()); } 
      }  
      }//End class  Application 
  </code></pre>