Static methods unallowed in Processing?

Viewed 2090

I apologize in advance if I'm not doing something correctly, or if I didn't see something that I should have.

I began programming with Java and am currently using Processing, which is a more user-friendly and easier-to-understand version of Java, at its core. I am attempting to define a static method on a class (allowed by Java), but it gives me the error "The method cannot be declared static; static methods can only be declared in a static or top level type."

My code, simplified to demonstrate the problem, is as follows:

class Item {
  static void test() {
    print("Hello");
  }
}

It will not run or compile, and as far as I can see, the only workaround would be to make it non-static and call it on specific objects.

Is there a way that I could define it such that I can keep it a static method?

Thanks in advance for any help with this problem.

1 Answers
Related