title: The type of the expression must be an array type but it resolved to float
body: <p>I hit a bump when I'm doing my Java code. I feel like I somehow got the concept messed up, like I not sure for this:</p>
  
  <pre><code>void setScore(float[] sco)
  {
      sco = score;
  }
  
  public void setScore(float sco, int id)
  {
      sco[id] = score;
  }
  </code></pre>
  
  <p>The error message corresponds to "sco[ID] = score; "</p>
  
  <pre><code>The type of the expression must be an array type but it resolved to float
  </code></pre>
  
  <p>I'm confused what I should put in the bracket, the book asks me to put "float[] score" instead of "float[] sco", but it doesn't work, so I edited a bit after several trials. This part of coding generally describes the method of overloading that stores the score for 5 subjects.</p>
  
  <p>And this is my whole coding:</p>
  
  <pre><code>public class Score {
  float math, english, physics, chemistry, biology;
  float sum, average;
  float[] score;
  int id;
  
  void setMath(float Math) {
      math = Math;
  }
  
  void setEnglish(float English) {
      english = English;
  }
  
  void setPhysics(float Physics) {
      physics = Physics;
  }
  
  void setChemistry(float Chemistry) {
      chemistry = Chemistry;
  }
  
  void setBiology(float Biology) {
      biology = Biology;
  }
  
  void setSum(float Sum) {
      sum = math + english + physics + chemistry + biology;
  }
  
  void setAverage(float Average) {
      average = sum / 5;
  }
  
  float getMath() {
      return math;
  }
  
  float getEnglish() {
      return english;
  }
  
  float getPhysics() {
      return physics;
  }
  
  float getChemistry() {
      return chemistry;
  }
  
  float getBiology() {
      return biology;
  }
  
  float getSum() {
      return sum;
  }
  
  float getAverage() {
      return average;
  }
  
  public void setScore(float[] sco)
  {
      sco = score;
  }
  
  public void setScore(float sco, int id)
  {
      sco[id] = score;
  }
  }
  </code></pre>
  
  <p>Now my problem solved! Since I just changed like this:</p>
  
  <pre><code>    public void score()
  {
  
  }
  public void setScore(float[] score)
  {
      sco = score;
  }
  </code></pre>
  
  <p>Can anyone tell me why now the problem resolved? Will really appreciate a lot!</p>