title: Problem with changing a field in one item in an ADT array
body: <p>I am trying to edit one item in the Person[] array but for some reason, whenever the setHasVirus is called, the whole array is changed to &quot;having the virus&quot;. Literally every single item's hasVirus variable is changed to true from false. I am trying to edit only the second item but it doesn't work. Could you please tell me what's the problem?</p>
  <pre><code>class Person{
      boolean vaccine;
      boolean hasVirus;
      boolean alive;
  }
  
  class arrayADT{
      Person[] people;
      int count; 
  }
  
  
  
  
  public static String inputString(String message)
      {
          Scanner scanner = new Scanner(System.in);
          System.out.println(message);
          return scanner.nextLine();
      }
      
      public static int inputInt(String message)
      {
          return Integer.parseInt(inputString(message));
      }
      
      public static int inputIntRange(String message, int min, int max)
      {
          int result = Integer.parseInt(inputString(message));
          while((result &lt; min) | (result &gt; max))
          {
              result = Integer.parseInt(inputString(message));
          }
      return result;
      }
      
      public static Person setVaccine(Person a, boolean b){ //accessor method
          a.vaccine = b;
          return a;
      }
      
      public static Person setHasVirus(Person a, boolean b){ //accessor method
          a.hasVirus = b;
          return a;
      }
      
      public static Person setAlive(Person a, boolean b){ //accessor method
          a.alive = b;
          return a;
      }
      
      public static Person createPatient(boolean a, boolean b, boolean c){ //initialises the object
          Person d = new Person();
          d = setVaccine(d, a);
          d = setHasVirus(d, b);
          d = setAlive(d, c);
          return d;
      }
  
  public static Person getSingleRecord(arrayADT ap, int number) 
      { 
          return ap.people[number]; 
      }
  
  public static arrayADT addPatientRecord(arrayADT ap, Person a) //adds one record to the existing array adt
      {
          ap.people[ap.count] = a; 
          ap.count = ap.count + 1; 
          return ap;     
      }
  
  public static arrayADT inputPeople(){
  arrayADT a = new arrayADT();
  int howMany = inputIntRange(&quot;Number of people to simulate?(between 100 and 1000)&quot;, 100, 1000);
  a.people = new Person[howMany];
  Person d = createPatient(false, false, true);
          for(int i = 0; i&lt;howMany; i++){
              addPatientRecord(a, d); //filling out the array with default values
          }
  setHasVirus(getSingleRecord(a, 2),true); //trying to edit only one item in the whole array
  return a;
  }
  </code></pre>