提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
这是一个静态方法,该方法创建并返回带有星期几名称的String数组:
public class Main { /** nowjava - 时代Java 提 供 **/ public static void main(String[] args) { String[] days = getDaysOfWeek(); printStringArray(days); } public static String[] getDaysOfWeek() { String[] days = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; return days; } public static void printStringArray(String[