Simple Array Usage in Java


Arrays are used to store multiple values in a single variable.

Source Code

int[] myArray = {10, 20, 30, 40, 50};
for (int i = 0; i < myArray.length; i++) {
    System.out.println(myArray[i]);
}

Use arrays to store a fixed-size collection of elements of the same type.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments