-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathPruebas.java
More file actions
43 lines (31 loc) · 917 Bytes
/
Pruebas.java
File metadata and controls
43 lines (31 loc) · 917 Bytes
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
import java.util.Scanner;
public class Pruebas {
public static void main(String[] args) {
int numero = 3;
final int opcionDinamica = 500;
switch(numero) {
case 0 : //
case 1 : //
case 2 : //
case opcionDinamica : //
}
Scanner sc = new Scanner(System.in);
System.out.println("Escoja una opcion (uno, dos, tres)");
String opcion = sc.nextLine();
final String xxx = "uno";
//En java 7 se puede usar un String en un switch aparte de int (o byte) y char
//Es case sensitive!
switch(opcion){
//case xxx : System.out.println("NO COMPILA");
// break;
case "uno" : System.out.println("Opcion uno!");
break;
case "dos" : System.out.println("Opcion dos!");
break;
case "tres" : System.out.println("Opcion tres!");
break;
default : System.out.println("No es tan dificil...");
}
sc.close();
}
}