mardi 12 janvier 2021

Why is my IDE telling me my if statement is redundant?

Why is NetBeans with TMC (IDE recommended by MOOC fi Java) telling my that my final if statement is redundant?

@Override
    public boolean equals(Object object) {
        if (this == object) {
            return true;
        }
        if (object == null) {
            return false;
        }
        if (this.getClass() != object.getClass()) {
            return false;
        }
        LicensePlate compared = (LicensePlate) object;
        
        if (!this.country.equals(compared.country)) {
            return false;
        }
        if (!this.liNumber.equals(compared.liNumber)) {
            return false;
        }
        return true;
        
    }

Aucun commentaire:

Enregistrer un commentaire