11/13 second Excercise


#1

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);
    spike.bark();
    spike.run(40);
    
    int tires = spike.getAge();
   
    

	}

}

Did you set the `spikeAge` variable equal to 
the result of calling the `getAge` method? Use the example to 
help you. << This ist he error message. Nothing help.
I hope you can help me.


#2

instruction:

Inside of main, set an int variable spikeAge to the value returned by spike.getAge();

so instead of this

int tires = spike.getAge();

your code should be like

int spikeAge = spike.getAge();

#3

Thank you it works !


#4

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