[Débutant] Problème de synthaxe
Bonjour,
Ayant commencé à apprendre java il y a 1 semaine, j'ai un petit soucis avec mon code.
Voici le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Scanner prenom = new Scanner (System.in);
System.out.print("\nComment vous appelez vous ? :");
String str = prenom.nextLine();
Scanner age = new Scanner (System.in);
System.out.print("\nQuel age avez vous ? : ");
int i = age.nextInt();
Scanner sexe = new Scanner (System.in);
System.out.print("\nEtes vous un homme ou une femme ? (H/F) : ");
String sex = sexe.nextLine();
char carac = sex.charAt(0);
System.out.print("\nVous vous appelez : " + str);
System.out.print("\nVous avez : " + i );
System.out.print(" ans");
switch (sex)
{
case "H":
System.out.print("\nVous êtes un homme");
case "F" :
System.out.print("\nVous êtes une femme");
default :
System.out.print("\nEtes vous un mutant ?");
} |
Au niveau du switch, que je choisisse, H ou F, il me met en permanence "êtes vous un mutant ? ", je ne comprend pas ou j'ai merdé.
Merci d'avance, :mrgreen:
PS : si il y a des trans qui passent par la no offense hein