I'm just starting on Java and I need some help. I know I cannot make a non-static reference on a static method but I need help trying to work around it. I was reading you can access non-static member variables, by creating an instance of the object but I'm not sure exactly how to do it. Here is some on the code. Any help or directions would be reallya appreciated.
package tweetClassification;
public class PriorityRules {
public static void prioritize( final String userInput ){
ClassificationRule.apply( aUserInput ); //ERROR
// Cannot make a static reference to
// the non-static method apply(String)
// from the type ClassificationRule
}
}
*----------------------------------------------------------------
package tweetClassification;
public class ClassificationRule {
public void apply (final String aUserInput) {
apply( aUserInput );
}
}
*----------------------------------------------------------------
package tweetClassification;
import java.util.ArrayList;
public class RuleFirstOccrnc extends ClassificationRule {
public void apply ( final String aUserInput ){
for( TweetCat t: TwtClassif.tCat )
applyFirstOccurrenceRuleTo( t, aUserInput );
}
*----------------------------------------------------------------
package tweetClassification;
public class RuleOccrncCount extends ClassificationRule {
public void apply ( final String aUserInput ){
for( TweetCat t: TwtClassif.tCat )
applyOccurrenceCountRuleTo( t, aUserInput );
}