Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Java Array Initialization

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,};


<< Array Creation
    Accessing Array Elements >>
Your rating: None Average: 2 (1 vote)
Share this

Post new comment