title: Calling a method from an array-list of objects
body: <p>I'm just starting with Java and I'm having trouble with the following code. I was using something like this to call the non-static apply method from a static method, but I dont think its very efficient. I set an array list of the rules that need to be applied but I can't get it to work.  </p>
  
  <pre><code>    ClassificationRule rules = new RuleFirstOccrnc();
      ClassificationRule rules1 = new RuleOccrncCount();
      rules.apply(aUserInput);
      rules1.apply(aUserInput); 
  </code></pre>
  
  <p>I'm getting this error when trying to call the apply() method from ClassificationRule "The method apply(String) is undefined for the type ArrayList". Any help would be greatly appreciated! </p>
  
  <pre><code>package tweetClassification;
  
  import java.util.ArrayList;
  
  public class PrioritRuls {
  
      //Set of rules to be applied
      final static ArrayList&lt;ClassificationRule&gt; rulesA
          = new ArrayList&lt;ClassificationRule&gt;();
  
      static{
          rulesA.add( new RuleFirstOccrnc() );
          rulesA.add( new RuleOccrncCount() );
      }
  
      // ******************************************* 
      public static void prioritize( final String aUserInput ){
  
          rulesA.apply(aUserInput); //ERROR
         // The method apply(String) is undefined
         // for the type ArrayList&lt;ClassificationRule&gt;
          }
  } 
  package tweetClassification;
  
  public class ClassificationRule {
  
       // *******************************************
       public void apply (final String aUserInput) {  
  
          apply( aUserInput );
          }
  }
  </code></pre>