package hello_java;
import java.util.Arrays;
public class ArrayIndex {
public static void main(String[] args) {
int [] a = {1,2,3,4,5,2,7,8,6};
int l = a.length;
for(int i = 0; i < l; i++){
if(i % 2 == 0){
System.out.println(a[i]);
}
}
}
}
public class ArrayIndex {
public static void main(String[] args) {
int [] a = {1,2,3,4,5,2,7,8,6};
for(int i = 0; i < a.length; i+=2){
System.out.println(a[i]);
}
}
}