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
Зарегистрируйся сейчас
или Подпишись на будущие тесты