title: How to use an array which was initialized in the constructor in a method?
body: <p>I'm trying to define an array of a user defined number of elements (degrees) and then a method which allows the user to set an element (coefficient) one at a time.</p>
  
  <pre><code>class Polynomial 
  {
  
      public Polynomial(int degree)
      {
          double[] coef = new double[degree];
      }
  
      public double[] setCoefficient(int index, double value) 
      {
          coef[index] = value; //coef was set in the constructor
          return coef;
      }
  }
  </code></pre>
  
  <p>I'm getting a compilation error in <code>coef[index] = value;</code>.</p>