- String数组
String[] array = {"a", "b", "c", "d", "e"};
-
根据下标遍历
for(int i = 0; i < 5; i++){ }
-
foreach遍历
for(String x : array){ }
-
迭代器遍历
List list = Arrays.asList(array);
-
stream遍历
Arrays.asList(array).stream().forEach(x -> System.out.println(x));
Arrays.asList(array).stream().forEach(System.out::println);