标签:each void java port test err 数组 i++ []
import java.util.Arrays;
public class test {
public static void main(String[] args) {
int[] arr = { 1, 2, 3, 4, 5 };
// for循环
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i]); //12345
}
// for each 循环
for (int a : arr) {
System.err.print(a); //12345
}
// Arrays类的toString方法
System.out.println(Arrays.toString(arr)); //[1,2,3,4,5]
}
}
标签:each void java port test err 数组 i++ []
原文地址:https://www.cnblogs.com/wuyuwuyueping/p/9579902.html