A java blog with a collection of examples and tutorials on Java and related technologies. (Under maintenance with continuous updates)
Be in touch with java jazzle or k2java.blogspot.com.
Pages
▼
Tuesday, May 17, 2011
Array Initialization in java
Shorthand method
Java has a shorthand to create an array object and supply initial values at the same time. Here's an example of the syntax at work:
int[] smallPrimes = { 2, 3, 5, 7, 11, 13 };
Notice that you do not call new when you use this syntax.
No comments:
Post a Comment