Question d’entretien chez Google

What's the difference between abstract and interface in Java

Réponses aux questions d'entretien

Utilisateur anonyme

5 déc. 2010

An abstract class may have some functions already defined where as an interface will not have any function defined. The extending(implements) class must define every function declared in the interface. With Abstract class, the extending class may override some of the functions defined in the abstract class.

Utilisateur anonyme

14 déc. 2010

Corrections to previous poster: 1. The extending class must define every function declared in te interface unless it is an abstract class 2. The extending class can extend multiple interfaces but only one class, abstract or not.

Utilisateur anonyme

8 févr. 2011

The interviewer does not require you to give syntax related answers, instead: 1- In general, the interfaces are favoured over calsses. 2- However, we use abstract classes in cases we want to enforce some implementations in subclasess