Bonjour tous ,
voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
abstract class Sandwich {
    void preparation() {;}
    abstract public String getIngredients();
}
class JambonBeurre extends Sandwich {
    public String getIngredients() {;}
}
class JambonFromage extends Sandwich {
    public String getIngredients() {;}
}
Lorsque j'appelle la méthode préparation() sur un objet Sandwich j'obtiens l'erreur suivante à l'exécution :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
Exception in thread "main" java.lang.AbstractMethodError: Sandwich.getIngredients()Ljava/lang/String;
Je ne comprends pas pourquoi ? je n'appelle même pas getIngredients() ?!