public class Arrays { public static void main(String[] args) //返回值设为String { for (String name : names()) System.out.println(name); } public static String[] names() { return new String[] {"jerry", "elaine", "george", "kramer"}; // return {"jerry", "elaine", "george", "kramer"} //这样不行; } }