-
Notifications
You must be signed in to change notification settings - Fork 0
/
foreach1.java
34 lines (27 loc) · 852 Bytes
/
foreach1.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
public class foreach1 {
public static void main(String[] args) {
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
for (String i : cars) {
if (i=="BMW")
{
System.out.println("Hi iam continue the code at bmw ");
continue;
}
System.out.println(i);
}
for (int i = 0; i < 10; i++) {
if (i >= 4) {
if (i==8)
{
System.out.println("Hi iam break the code at 8 ");
break;
}
else{
System.out.println("Hi iam continue the code at greater than 4");
continue;
}
}
System.out.println(i);
}
}
}