public class Test { public static void main (String[] args) { String[] a = {"roll out", "rule out", "normalcy", "palaver", "satirical", "rut"}; //下面提供两种遍历array的方法: //第一种方法: for (int i = 0; i < a.length; i++) { System.out.println(a[i]); } System.out.println(); //遍历后,换行 //第二种方法: for (String item : a) { System.out.println(item); } } }