Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

278
Visualizações
Abstract method in abstract Derived class overrides/implements abstract or concrete method of abstract Base class. How and why?

Came across interesting inheritance / overriding issue (taken from here).

When both Base and Derived classes are abstract, and

  1. both have exactly same abstract method, or
  2. abstract Base has concrete method, and Derived declares SAME method abstract.

I don't understand why Eclipse IDE calls it in Derived

  1. implements (it gives NO CODE / BODY in Derived!)
  2. overrides (also gives NO CODE / BODY in Derived!)

Snippet 1:

public abstract class Girl {
     abstract String getDescription();
}


abstract class GirlDecorator extends Girl {
       abstract String getDescription();  // implements Girl.getDescription() - says Eclipse IDE
}

Snippet 2:

public abstract class Girl {
    String description = "no particular";

      String getDescription() {
          return description;
      }
}

abstract class GirlDecorator extends Girl {
       abstract String getDescription();  // overrides Girl.getDescription() - says Eclipse IDE
}
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

In Java there are two types of methods (non-static)

  1. Virtual - Normal method, must be implemented in the base class but can be overridden by inheritance.

  2. Abstract - Method that is not implemented in the base class but in the derived class.

So that wraps it, virtual methods are not implemented in the derived class, they are implemented in the base class and can be overridden by the derived class. Abstract methods are not implemented in the base class, they are implemented in the derived class.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda