title: Assign a value to a String variable in a String array
body: <p>I am trying to assign values to String variables <strong><em>within</em></strong> an array:</p>
  
  <pre><code>String details = "passFirst0,passLast0,Molly,Quinn";
  Passenger passenger = new Passenger(details);
  
  public class Passenger {
  
      private String firstNameField;
      private String lastNameField;
      private String firstName;
      private String lastName;
  
      public Passenger(String details) {
          String[] temp = details.split(",");
          String[] fields = {firstNameField, lastNameField, firstName, lastName};
  
          for (int ctr = 0; ctr &lt; fields.length; ctr++) {
              fields[ctr] = temp[ctr];
          }
  
          // Print instance variables - all null
          System.out.println(this.firstNameField);
          System.out.println(this.lastNameField);
          System.out.println(this.firstName);
          System.out.println(this.lastName);
  
          // Print array - has values
          System.out.println(Arrays.toString(fields));
      }
  
      // Methods
  }
  </code></pre>
  
  <p>However, the instance variables themselves remain null, while the <code>fields[]</code> has values when you iterate through the array.</p>
  
  <p>Why is this so and how to accomplish this?</p>