创建数组并使用常量值初始化它的简便方法:
public class Main { public static void main(String[] args) { /** 来自 NowJava.com - 时代Java**/ String[] days = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; int[] primes = { 2, 3, 5, 7, 11, 13, 17 }; primes = new int[] { 2, 3, 5, 7, 11, 13, 17 }; } } /* 来自 *NowJava.com*/