有如下数组:
String str [] ={"a", "b", "c", "d", "e"};
1.for循环遍历
for(int i = 0; i < str.length; i++){
System.out.println(str[i]);
}
2.foreach遍历
for(String x : str){
System.out.println(x);
}
3.迭代遍历
List list = Arrays.asList(str);
Iterator iterator = list.iterator();
while(iterator.hasNext()){
System.out.println(iterator.next());
}