Java | different ways to print array values
There are several ways to print the elements of an array in Java. Here are the most common ones:
int[] array = {1, 2, 3, 4, 5};
for (int i = 0; i < array.length; i++) {
System.out.println(array[i]);
}
No comments:
Post a Comment