Main method use

I've got this Speaker class that implements the Adjustable interface (below). In the Speaker class, how do I code the Main method in order to print the string that's in the printStates method ? --------------------------------------------------- public class Speaker implements Adjustable {

But note, main(...) is static, and printStates() is not. So you'll have to have an instance of your Speaker class to call the printStates() method on.

Note that your class Speaker has a member variable of type Speaker:

This line is going to get you into trouble - it causes an infinite loop.

When you create a new Speaker object, the member variables of that new object are initialized. One of the member variables is a Speaker. So the member Speaker will be created. But it has in turn a Speaker as a member variable. That one will be initialized. And that last one again has a Speaker member variable. Etc...

You just call the printStates() method from the main(...) method. But note, main(...) is static, and printStates() is not. So you'll have to have an instance of your Speaker class to call the printStates() method on.

Yeah, I got an error earlier, regarding using non-static variables in a static method, when I tried to call the printStates() method from the main() method. You recommended I create an instance of the Speaker class to call the printStates() method on, but I thot that's what I was doing when I used the line: Speaker speaker1 = new Speaker();

So, I should remove that line, right? Then what ? Thanks for your assistance.