This commit is contained in:
Rémi Heredero 2021-11-28 12:26:36 +01:00
parent 0396ab6fc7
commit a4e4c25dcd
3 changed files with 28 additions and 11 deletions

View File

@ -1,6 +1,33 @@
package C08_Structures_de_donnees.C081_Enum;
enum Glace {VANILLE, CHOCOLAT, FRAISE, MANGUE};
// enum Cat {MINOU, CHATONS, CONNAIS_PAS_D_AUTRES, TOTO};
public class App {
public static void main(String[] args) throws Exception {
System.out.println("Hello, World!");
Glace favorite = Glace.VANILLE;
// Cat simba = Cat.CHATONS;
for (int i = 0; i < 4; i++) {
switch (favorite) {
case VANILLE:
System.out.println("Vanille");
favorite = Glace.CHOCOLAT;
break;
case CHOCOLAT:
System.out.println("Chocolat");
favorite = Glace.FRAISE;
break;
case FRAISE:
System.out.println("Fraise");
favorite = Glace.MANGUE;
default:
System.out.println("Mangue");
favorite = Glace.VANILLE;
break;
}
}
}
}

View File

@ -1,5 +0,0 @@
package C08_Structures_de_donnees.C081_Enum;
public class Cat {
}

View File

@ -1,5 +0,0 @@
package C08_Structures_de_donnees.C081_Enum;
public class Glace {
}