Stuck on 5/13, code looks correct, no console output, error message received


#1

I have followed the example exactly, and keep receiving an error message which reads "Set age equal to dogsAge inside of the constructor block. Use the example to help you."

class Dog {

  int age;
  
  public Dog(int dogsAge) {
    
  	dogsAge = age; 
    
  }


	public static void main(String[] args) {

	}

}

I have tried messing with the formatting, making sure everything is in the right place syntax-wise, and am still running into problems. I wasn't able to find anyone running into the same issue in any previous forum topics, and if this thread proves fruitless, I will most likely file a bug report.


#2

Hi there,

Try flipping around dogsAge and age. ie age = dogsAge;

This way you will be taking the value you pass from the parameter dogsAge and assign it to the instance variable age correctly.


#3

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