-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTheArrays.java
More file actions
29 lines (21 loc) · 750 Bytes
/
Copy pathTheArrays.java
File metadata and controls
29 lines (21 loc) · 750 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
import java.util.Arrays;
public class TheArrays {
public static void main(String[] args) {
String[] footballers = new String[5];
footballers[0] = "Ronaldo";
footballers[1] = "Messi";
footballers[4] = "Lewandowski";
System.out.println(Arrays.toString(footballers));
int[] goals = {900, 800, 500};
for (int i = 0; i < goals.length; i++) {
System.out.println(goals[i]);
}
for (int i = footballers.length - 1; i >= 0; i--) {
System.out.println(footballers[i]);
}
for (String footballer : footballers) {
System.out.println(footballer);
}
Arrays.stream(footballers).forEach(System.out::println);
}
}