Checking the argument

Report a typo

The constructor of this class has an assertion that throws an error if the argument is null.

class Animal {
    private String name;

    Animal(String name) {
        _____________________ : "Name must not be null";
        this.name = name;
    }
}

Fill in the missing part of code.

Enter a short text
___

Create a free account to access the full topic