int[] arr = { 0, 1, 2 };
//for
for (int i = 0, len = arr.length; i < len; i++) {
System.out.println(arr[i]); // 0 1 2
}
//for in
for (int x : arr) {
System.out.println(arr[x]);
}
本文出自 “猴子也疯狂” 博客,谢绝转载!
原文地址:http://1251769215.blog.51cto.com/11633863/1841090