-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLesConditions.java
More file actions
39 lines (32 loc) · 1.01 KB
/
Copy pathLesConditions.java
File metadata and controls
39 lines (32 loc) · 1.01 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.Scanner;
public class LesConditions {
public static void main(String [] args){
// condition if else
int money=2000;
if(money==2000) {
System.out.println("les deux valeurs sont les memes");
}
else{
System.out.println("les deux valeurs ne sont pas les memes");
}
// condition switch
int choix;
Scanner scanner = new Scanner(System.in);
System.out.println("Donne moi une valeur");
choix = scanner.nextInt();
switch(choix){
case 1:
System.out.println("Bonjour");
break;
case 2:
System.out.println("Hello");
break;
case 3:
System.out.println("Hello mbarkout");
break;
default: // default est executé quand le choix n'est pas dans la liste définie
System.out.println("Choix incorrect");
break;
}
}
}