7/13 Why can't I get past this error?


#1


#2

The only thing that jumps out is the space

... = new Dog (9);

Try,

    Dog spike = new Dog(9);

#3

I removed the space, same error. Thanks for the suggestion...
It fetched the code which was EXACTLY the same as what I had so it seems to be a bug.


#4

The instructions are looking for the required int parameter age where you have specified it as dogsAge. (Also, it may or may not be a problem, but your field age in the class has no accessibility modifier public/private/etc. Perhaps, for this lesson, set it topublic(though keep in mind, often in "real life" you will need to have the modifier set toprivate.))

To get around clashing with the variables being named the same, you need to make use of this to refer to the current Class you are writing.

example

class Herald {
  private String name;
  public Herald(String name) {
    this.name = name; //"this" refers to the private field above and the other refers to the constructor parameter.
  }
  public static void main(String[] args) {
    Herald joe = new Herald("Joe");
  }
}