Java examples for Language Basics:Array
Shorthand way to create an array and initialize it with constant values:
public class Main { public static void main(String[] args) { 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 }; }//w ww . java 2 s . c o m }