36 lines
743 B
Java
36 lines
743 B
Java
|
class Etudiant {
|
||
|
// attributs
|
||
|
private boolean apprenti;
|
||
|
private String nom;
|
||
|
public String promo;
|
||
|
|
||
|
// constructeur
|
||
|
public Etudiant() {
|
||
|
this.apprenti = false;
|
||
|
}
|
||
|
public Etudiant(String nom, boolean app) {
|
||
|
this.apprenti = app;
|
||
|
this.nom = nom;
|
||
|
}
|
||
|
|
||
|
// méthodes
|
||
|
public void setNom(String nom) {
|
||
|
this.nom = nom;
|
||
|
}
|
||
|
public boolean getApprenti() {
|
||
|
return this.apprenti;
|
||
|
}
|
||
|
public String getNom() {
|
||
|
return this.nom;
|
||
|
}
|
||
|
public String getPromo() {
|
||
|
return this.promo;
|
||
|
}
|
||
|
|
||
|
public static void test(String[] ab) {
|
||
|
Etudiant e1 = new Etudiant("Dupond", true);
|
||
|
|
||
|
e1.nom = "Efrei"; // possible car dans la classe
|
||
|
}
|
||
|
}
|