logo

Crowdly

Soient les classes Java suivantes : class Forme { private String nom; ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Soient les classes Java suivantes :

class Forme {

private String nom;

public Forme(String nom) {

this.nom = nom;

}

public String donneInfos() {

return "nom : " + this.nom;

}

}

class Carre extends Forme {

private int taille;

public Carre(String nom, int taille) {

super(nom);

this.taille = taille;

}

@Override

public String donneInfos(boolean format) {

if (format == true) {

return super.donneInfos() + ", taille : " + this.taille;

} else {

return "taille : " + this.taille;

}

}

}

class Test {

public static void main(String[] args) {

Carre c = new Carre("carre1", 4);

System.out.println(c.donneInfos());

}

}

0%
0%
More questions like this

Want instant access to all verified answers on moodle.univ-lr.fr?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!