title: Adding data to arrayList Java
body: <p>So I'm creating a logging program where a user enters the KM's and it saves it etc. </p>
  
  <p>I take in four variables - start KM, end KM, start and end location. I'm new to java so I'm just wondering if anyone can confirm if theres a better way to do this. This is my code so far, I want to save it to an array of sorts (to a list??) so I can access each object i.e. the startKM, but they need to be on the same line, as in object 1 of array etc. and then write to file, </p>
  
  <p>What I was thinking of doing was saving that linked list to a file, and adding a ; in the toString method and when reading the file in just breaking it at the ; Is there a better way to do this?? Thanks guys. the data is assigned from whatever the user enters in the text fields.</p>
  
  <pre><code>double startKM;
  double endKM;
  String startLocation;
  String endLocation;
  
  
  startKM = Double.parseDouble(txtStartKM.getText());
  endKM = Double.parseDouble(txtEndKM.getText());
  
  startLocation = txtStartLocation.getText();
  endLocation = txtEndLocation.getText();
  
  details.startKM = startKM;
  details.endKM = endKM;
  details.startLocation = startLocation;
  details.endLocation = endLocation;
  
  //List&lt;DrivingDetails&gt; detailsList = new ArrayList&lt;DrivingDetails&gt;();
  List detailsList = new ArrayList();
  
  detailsList.add(details);
  
  System.out.println("LinkedList contains = \t " + detailsList.toString());
  </code></pre>
  
  <p>edit: I have another class (DrivingDetails) which holds the following variables:</p>
  
  <pre><code>public class DrivingDetails {
  
     double startKM;
     double endKM;
     String startLocation;
     String endLocation;
  }
  </code></pre>