Why can one change the return type of an abstract method in java?
<p>Why is changing the return type of an abstract method in a child class allowed?</p>

<pre><code>abstract class Animal {
    public abstract Animal assing(Animal a);
}

class Lizard extends Animal {
    @Override
    public Lizard assing(Animal a) {
        return new Lizard();
    }
}

class Chicken extends Animal {
    @Override
    public Chicken assing(Animal a) {
        return new Chicken();
    }
}
</code></pre>

<p>whereas changing the parameter type is not allowed:</p>

<pre><code>abstract class Animal {
    public abstract void foo(int x);
}

class Lizard extends Animal {
    // compiler error
    // the type Lizard must implement the inherited abstract method Animal.foo(int)
    public void foo(float x) {
    }
}

class Chicken extends Animal {
    @Override
    public void foo(int x) {
    }
}
</code></pre>
