Methods II instruction 3, command not typed correctly?


#1



https://www.codecademy.com/en/courses/learn-java/lessons/object-oriented-programming/exercises/using-methods-2?action=resume


In my code, it's claiming that I have not called the "System.out.println(spikeAge);" method in the code, for whatever reason. I've tried restarting this section, rewriting it, copying and pasting it from the left box, everything, but it seems to think I'm incorrectly writing the code each time. Is it something obvious I'm missing? I'm using Chrome, if that helps.


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(4);
	int spikeAge = spike.getAge();
		System.out.println(spikeAge);
    spike.bark();
		spike.run(600);
  }
}

Replace this line with your code.


#2

Try running it in a different browser.


#3

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