[Solved] Java constructor requires argument

[ad_1]

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

[ad_2]

solved Java constructor requires argument