11/13 what did i do wrong?

it keeps saying there is a typo even though im pretty sure there isnt
heres my code:

class Dog {
  
  int age;

	public Dog(int dogsAge) {
    
  	age = dogsAge;
    
  }
  
  public void bark() {
		
    System.out.println("Woof!");
    
	}
	
  public void run(int feet) {
    
    System.out.println("Your dog ran " + feet + " feet!");

	}
  public int getAge() {
    return age;
  }
  
	public static void main(String[] args) {
    
  Dog spike = new Dog(5);
    int spikeAge = spike.getAge();
    System.out.println(spikeAge);
    spike.bark();
    spike.run(40);

	}

}
  • Which exercise and step is this question about?
  • Does it really say “there is a typo”?

A post was split to a new topic: 11. I’m stuck here

these line should be below after spike.run(40); `

int spikeAge = spike.getAge();
System.out.println(spikeAge);


so your code should  look like


Dog spike = new Dog(5);
spike.bark();
spike.run(40);
int spikeAge = spike.getAge();
System.out.println(spikeAge);

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.