Learn Java Help at 65% 10. Methods ||


This is my code:
(Go down for more info)
class Dog {

int age;

public Dog(int dogsAge) {
age = dogsAge;


public void bark() {



public void run(int feet) {

System.out.println("Your dog ran " + feet + " feet!");


public static void main(String[] args) {

Dog spike = new Dog(5);



The code for some reason works in the editor but in the box it is incorrect.
Please help.
Instructions below

Fantastic! Similar to constructors, you can customize methods to accept parameters.

class Car {

int modelYear;

public Car(int year) {

    modelYear = year;


public void startEngine() {

public void drive(int distanceInMiles) {

    System.out.println("Miles driven: " + distanceInMiles);


public static void main(String[] args){

    Car myFastCar = new Car(2007);


In the example above, we create a drive method that accepts an int parameter called distanceInMiles. In the main method, we call the drive method on the myFastCar object and provide an int parameter of 1628.

Calling the drive method on myFastCar will result in printing Miles driven: 1628 to the console.
In between the bark and main methods, add a method called run to the Dog class by typing:


You have to do one step at a time and then press Run to get your checkmark. You can't go ahead and do all of the steps in one go.


I have done that before with angular, sql, javascript, and the beginning of this and it worked just fine.


i did it that way but it did´t work. plis help i need to continue to the next exersices!!!


You can try these steps:

  • reload/refresh the browser
  • use the "I want to restart this exercise" to clear it all out and start fresh

If you do restart, and Step 1 doesn't work, come back and post a screenshot.