title: Syntax issue with variable-length arguments assignment
body: <p>I am trying to write a Java program that will calculate the product of a series of integers that are passed to method product using a variable-length argument list. The method must be tested with several calls, each with a different number of arguments.</p>
  
  <p>I have written the code to the best of my understanding but cannot get it to compile without errors, and cannot grasp what I am doing wrong. I suspect I have something out of order, but just can't figure out what and am hoping for some advice. This is part of an assignment for my Java development class at school.</p>
  
  <pre><code>public class VLArgs 
  {
      //calculates the product
      public static int product(int...numbers) 
      {
  
          int product = 1;
  
          //multiplies the integers
          for (int number:numbers) 
          {
              product *= number;
          }
          return product;
      }
  
      public static void main(String[] args) 
      {
  
          int a = 1;
          int b = 2;
          int c = 3;
          int d = 4;
          int e = 5;
  
          //displays the values   
          System.out.printf(“a = %d, b = %d, c = %d, d = %d, e = %d\n”,
          a, b, c, d, e);
  
          //calls the product of the values with a different number of arguments in each call
  
           System.out.printf(“The product of a and b is: %d\n”,product(a, b));
  
           System.out.printf(“The product of a, b and c is: %d\n”,product(a, b, c));
  
           System.out.printf(“The product of a, b, c and d is: %d\n”, product(a, b, c, d));
  
           System.out.printf(“The product of a, b, c, d and e is: %d\n”, product(a, b, c, d, e));
       }
  }
  </code></pre>
  
  <p>The main error I am receiving is:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    at VLArgs.main(VLArgs.java:31)</p>
  </blockquote>
  
  <p>And all of the errors within that are syntax errors (about 35).</p>