Given:

interface Animal {
    void eat();
}
 
// Insert code here

public class HouseCat implements Feline {
    public void eat() { }
}
Which of the following lines will allow the code to compile successfully?
Explanation
Declaring the void eat() method in one or both of the interfaces doesn't affect anything. You can define method in an interface with a default keyword The HouseCat class that implements the Feline interface, is correctly implementing the declared method.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Продовжуйте вивчати
тести з Java
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести