Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor

Great! Now the bark method is available to use on the spike object. We can do this by calling the method on spike.

Here is an example of calling a method on an object using the Car class:

class Car { int modelYear; public Car(int year) { modelYear = year; } public void startEngine() { System.out.println("Vroom!"); } public static void main(String[] args){ Car myFastCar = new Car(2007); myFastCar.startEngine(); }

In the example above, we call the startEngine method on the myFastCar object. Again, this occurs inside of the main method. Running the program results in printing Vroom! to the console.

Report a Bug
If you see a bug or any other issue with this page, please report it here.