-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlgorithm.java
More file actions
36 lines (31 loc) · 802 Bytes
/
Copy pathAlgorithm.java
File metadata and controls
36 lines (31 loc) · 802 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
package com.diosoft.algorithms;
public class Algorithm {
public static void firstExample(){
int [] array = {21, 72, 100, -900, 24, 87};
for (int i = 0; i < array.length; i++) {
System.out.println("Element from first example " + array[i]);
}
}
public static void secondExample(){
int count = 4;
int [] array = new int[count];
array[0] = 1;
array[1] = 2;
array[2] = 10;
array[3] = -9;
for (int i = 0; i < count; i++) {
System.out.println("Element from second example " + array[i]);
}
}
public static void thirdExample(){
int [] array2 = {31, 92, 0, 1, 0};
for (int element : array2) {
System.out.println("Element from third example " + element);
}
}
public static void main(String[] args) {
firstExample();
secondExample();
thirdExample();
}
}