Looking for R2.01 Developpement Objets test answers and solutions? Browse our comprehensive collection of verified answers for R2.01 Developpement Objets at celene.univ-orleans.fr.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Voici une déclaration de plusieurs classes en Java. Des blocs d'instructions sont numérotés.
public abstract class Logement{
protected int superficie;
protected int nbPieces;
private int identifiant;
//6
public Logement(int superficie, int nbPieces, int identifiant){
this.superficie = superficie;
this.nbPieces = nbPieces;
this.identifiant = identifiant;
}
//7
public void affiche(){
System.out.println("Superficie :"+this.superficie+", Nombre pièces :"+this.nbPieces);
}
}
public class Maison extends Logement{
protected int superficieJardin;
//8
public Maison(int superficieJardin){
super(100,4,0);
this.superficieJardin = superficieJardin;
}
//9
@Override
public void affiche(){
super.affiche();
System.out.println(this.superficie+" "+this.identifiant);
}
}
public class Appartement extends Logement{
protected int numEtage;
//10
public Appartement(int superficie, int nbPiece, int identifiant, int numEtage){
super(superficie, nbPiece, identifiant);
this.numEtage = numEtage;
}
}
public class Executable {
public static void main(String [] args){
//1
Logement logement = new Logement(200,8,5);
//2
Appartement appartement = new Appartement(50, 2, 6, 2);
//3
Logement maison = new Maison(100);
//4
maison.affiche();
//5
appartement.affiche();
}
}
Est-ce que que chaque bloc d'instructions numéroté est correcte (réponse Vrai) ou provoque une erreur de compilation (réponse Faux)
//1
Logement logement = new Logement(200,8,5);
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!