2024-01-19 16:29:59 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.lang.Integer;
|
2024-03-14 10:23:19 +01:00
|
|
|
import java.lang.Number;
|
2024-01-19 16:29:59 +01:00
|
|
|
|
|
|
|
public class ForEach {
|
2024-03-14 10:23:19 +01:00
|
|
|
public m() {
|
2024-01-19 16:29:59 +01:00
|
|
|
var list = new ArrayList<>();
|
|
|
|
list.add(1); list.add(2); list.add(3);
|
|
|
|
|
|
|
|
var sum = 0;
|
|
|
|
for (var i : list) {
|
|
|
|
sum = sum + i;
|
|
|
|
}
|
|
|
|
return sum;
|
|
|
|
}
|
2024-03-14 10:23:19 +01:00
|
|
|
|
|
|
|
public m2() {
|
|
|
|
var list = new ArrayList<? extends Number>();
|
|
|
|
|
|
|
|
for (Number n : list) {
|
|
|
|
}
|
|
|
|
}
|
2024-01-19 16:29:59 +01:00
|
|
|
}
|