title: Making a constructor that accepts an integer array
body: <p>How can I pass in an integer array into my constructor?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  
  public class Temperature implements Serializable
  {
      private int[] temps = new int [7];
      public Temperature(int[] a)
      {
          for(int i=0; i &lt; 7; i++)
          {
              temps[i] = a[i];
          }
  
      }
      public static void main(String[] args)
      {
          Temperature i = new Temperature(1,2,3,4,5,6,7);
      }
  }
  </code></pre>
  
  <hr>
  
  <p>The error given is:</p>
  
  <pre><code>Temperature.java:17: error: constructor Temperature in class Temperature cannot be applied to given types;
          Temperature i = new Temperature(1,2,3,4,5,6,7);
                          ^
    required: int[]
    found: int,int,int,int,int,int,int
    reason: actual and formal argument lists differ in length
  1 error
  </code></pre>