1// Accessing array elements using for loop
2public class AccessingArrayElements
3{
4 public static void main(String[] args)
5 {
6 int[] arrNum = {25, 23, 15, 20, 24};
7 for(int a = 0; a < arrNum.length; a++)
8 {
9 System.out.println(arrNum[a]);
10 }
11 }
12}
1int[] intArray = new int[20];
2String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
1For example: int[ ] num = new int[6];
2public class AccessingArrayElements
3{
4 public static void main(String[] args)
5 {
6 int[] arrNum = {25, 23, 15, 20, 24};
7 for(int a = 0; a < arrNum.length; a++)
8 {
9 System.out.println(arrNum[a]);
10 }
11 }
12}
1// How to use arrays
2// Julian
3 public static void main(String[] args)
4 {
5 // Initialize array
6 int[] arrNum = {25, 23, 15, 20, 24};
7 // Recorrerlo
8 for(int a = 0; a < arrNum.length; a++)
9 {
10 System.out.println(arrNum[a]);
11 }
12 }