✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
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);
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!