title: Distance between variables in an array
body: <p>I am new to Java and I am trying get distances between the variables in the stations field and it doesn't seem to work. </p>
  
  <pre><code>public static void main(String[]args){
  double[] stations = {10,20,30};{
  for(int i=0;i&lt;stations.length-2;i++){
      double distance=stations[i+1] + stations[i];
  }
  </code></pre>