title: Java append instances of a String to a String which separated by commas
body: <p>So I have a string variable which is meant to hold names of cars separated by commas.</p>
  
  <pre><code>String cars = "";
  </code></pre>
  
  <p>What I want to do is append cars to this string. The way a new car would be added:</p>
  
  <pre><code>String newCar1 = "Mini";
  String newCar2 = "LandRover";
  appendToCars(newCar1);
  appendToCars(newCar2);
  </code></pre>
  
  <p>Then currently I have this, which I primarily need help with.</p>
  
  <pre><code>public void appendToCars(String newCar)
  {
  cars = cars + "," + newCar;
  }
  </code></pre>
  
  <p>So output should be:</p>
  
  <pre><code>Mini,LandRover
  </code></pre>
  
  <p>but it's: </p>
  
  <pre><code>[,]Mini
  </code></pre>
  
  <p>Been racking my brain about this for hours figuring out how to do it, but I just can't get the result I actually want.</p>
  
  <p>Im also using a JUnit test for this which reads :</p>
  
  <pre><code>@Test
  public void testAppendToCars() {
      System.out.println("appendToCars");
      String newCar1 = "Mini";
      String newCar2 = "LandRover";
      String expResult = newCar1 + "," + newCar2;
      testDel.appendToCars(newCar1);
      testDel.appendToCars(newCar2);
      String result = testDel.getCars();
      assertEquals("Delivery notes incorrectly stored", expResult, result);
  </code></pre>