-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitchCase.java
More file actions
56 lines (53 loc) · 1.42 KB
/
SwitchCase.java
File metadata and controls
56 lines (53 loc) · 1.42 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//importando o scanner
import java.util.Scanner;
//criando a classe
public class SwitchCase {
//criando um metodo main
public static void main(String[] args) {
//objeto para scanear a tecla do usuario
Scanner mes = new Scanner(System.in);
//imprimindo
System.out.println("Digite o mes");
//usando switch para ser chamado de acordo com oque o usuario digitar
switch(mes.nextInt()) {
case 1:
System.out.println("Janeiro");
break;
case 2:
System.out.println("Fevereiro");
break;
case 3:
System.out.println("Março");
break;
case 4:
System.out.println("Abril");
break;
case 5:
System.out.println("Maio");
break;
case 6:
System.out.println("Junho");
break;
case 7:
System.out.println("Julho");
break;
case 8:
System.out.println("Agosto");
break;
case 9:
System.out.println("Setembro");
break;
case 10:
System.out.println("Outubro");
break;
case 11:
System.out.println("Novembro");
break;
case 12:
System.out.println("Dezembro");
break;
default:
System.out.println("Valor invalido! escolha o mes de 1 a 12");
}
}
}