java – When declaring an interface in the class, who should implement it?

Question:

class Gerente extends Funcionario implements Autenticavel {

Did he mean that Gerente implements the Autenticavel interface, or Funcionario who will implement the interface?

Answer:

The Gerente implement it right there below. The signature of this class has the interface, so this class will have to be implemented.

If Funcionario had already implemented, even if a redeployment is done in Gerente , it would not need to declare in this class, it would already be implicitly declared because it has inherited from a class that already has the interface.

I didn't get down to it that this particular heritage seems conceptually wrong because it's not the focus of the question.

Scroll to Top