-
Notifications
You must be signed in to change notification settings - Fork 0
/
SentenciasBucleEtiquetas.java
45 lines (40 loc) · 1.34 KB
/
SentenciasBucleEtiquetas.java
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
public class SentenciasBucleEtiquetas {
public static void main(String[] args) {
bucle:
for (int i = 1; i <= 7; i++) {
int j = 1;
while ( j <= 8) {
if (i == 6 || i == 7) {
System.out.println("Dia " + i + ": descanso de fin de semana!");
continue bucle;
}
System.out.println("Día " + i + ", trabajando a las " + j + "hrs. ");
j++;
}
}
System.out.println("\n=================================================");
bucle1:
for (int i = 0; i < 5; i++) {
System.out.println();
int j = 0;
while ( j < 5) {
if (i == 2) {
continue bucle1;
}
System.out.print("[i = " + i + ", j = " + j + "], ");
j++;
}
}
System.out.println("\n=================================================");
etiqueta:
for (int i = 0; i < 5; i++) {
System.out.println();
for (int j = 0; j < 5; j++) {
if (i == 2) {
break etiqueta;
}
System.out.print("[i = " + i + ", j = " + j + "], ");
}
}
}
}