title: Totalling elements in an arraylist
body: <p>I'm trying to do the following:</p>
  
  <p>A method that totals all of the cat’s legs in an ArrayList of cats.</p>
  
  <p>However I can't seem to have it add up the total number of cat legs in the array, or display it on the console.</p>
  
  <pre><code>   public static int getNumOfLegs()
  {
  
      return numOfLegs;
  }
  
  public void setNumOfLegs(int numOfLegs)
  {
      this.numOfLegs = numOfLegs;
  
  }
  
  
  
     public static int totalNumOfLegs(ArrayList&lt;Cat&gt; catList)
  {
      int total = 0;
      for (Cat c: catList)
      {
          total = total + getNumOfLegs();
      }
  
  
      return total;
  
  }
  </code></pre>
  
  <p>Much appreciated.</p>