Domanda di colloquio di EPAM Systems

Abstract class vs interface in Java 8

Risposta di colloquio

Anonimo

21 nov 2020

They become very close to each other but abstract class still responsible for core logic with possibility to make some logic in constructor, operating with class level variables also keep some state, interface is a high level abstraction which provide contracts for an object, but from Java 8 interface also can keep some default behavior (don’t force you to make changes in a legacy code) with ability to restrict it’s customization (static methods)

1