[Solved] Java constructor requires argument


Your constructor declaration is wrong. Constructors look like this:

public Dog(String name) {
    this.name = name;
}

It does not have the void modifier.

The constructor declaration in the class MyDog is correct but it is not correct in Dog.

0

solved Java constructor requires argument