Java Array Initialization
Once created, array elements can be initialized explicitly using
loop or initialization can be combined with the array creation using
following syntax.
<type>[] arrayName = { <initialization value list>};
Following is the example of the same.
int [] myIntArray = {1,2,3,4};
Note: initialization list can be legally terminated by comma. For
example
int [] myIntArray = {1,2,3,4,};
|