title: How to store a value, passed from a method which has an array as parameter and return type of double?
body: <p>I have a method which has an array as parameter, I've wanted to pass a double value from it but can't store the value passed from the method.</p>
  
  <pre><code>public static void main(String[] args) {
  
      double [] temperature = {2.5, 10.3, 50.0, 66.7, 77.9, 33.2, 0.33};
  
      double final = averageTemp(temperature);
  
      System.out.println(final);
  }
  public static double averageTemp(double [] temp){
      int size =temp.length ;
      double total = 0;
      for(int i =0; i&lt;size; i++){
          total += temp[i];
      }
      double average =  total/size;
  
      return average;
  }
  </code></pre>
  
  <p>I expect to store the returned "average" in "final" variable and print it.
  But getting error.</p>