Ask coding questions

← Back to all posts
What am I doing wrong here?
Jerrywkane

Click on the word classes on the left to go into my repl and see both classes. In this repl there are two different classes, and I have been given a step by step list of instructions on how to execute the program. Once I finished all of the steps, it says that I am doing something wrong. Can anyone please help me figure out what I am doing wrong here?

Voters
Jerrywkane
Comments
hotnewtop
SixBeeps

To call a method from one class in another, you must specify which class you wish to call it on. So if I make a class called Car and there's a method in Car called honk(), I'd need to say Car.honk() instead of just honk() if I want to call it in my Main class.

Next, I think Step 4 from the instructions is a little confusing. What I think it wants you to do is to make greeting() non-static, so first remove the static modifier from greeting(). Then, you'll want to make the new Dog variable in the main method instead of inside the greeting method. Finally, you'll call greeting() on the new Dog object you made.

If there's anything that you'd like me to explain further, I can.