@Test
public void test() {
int[] array = {1, 2, 3, 4, 5};
for (int i = 0; i < array.length; i++) {
System.out.println(array[i]);
}
}
@Test
public void test() {
int[] array = {1, 2, 3, 4, 5};
for (int a : array) {
System.out.println(a);
}
}
调用时传入要遍历打印的数组返回一个包含数组元素的字符串,这些元素被放置在括号内,并用逗号分开
@Test
public void test() {
int[] array = {1, 2, 3, 4, 5};
System.out.println(Arrays.toString(array));
}