Java Array

We know that variables are used to store data in a Java program. We also know that each variable can store not more than one data item. So, what do we do if we need to store a large number of data items, say 50. Well, we can use 50 variables, one for each of the 50 data items, but we need to write 50 lines of code for setting up these variables, or we can use ARRAYs. Which will need just a single line. Most real-world programs handle vast amount of data. An array with loops can relatively handle a vast amount of data.

     An array is an object that is used to store a list of values, all of which have the same data type (Check Two Dimensional Array for complex data type). An array is a reference data type just like class. It is made of an attached block of memory. This memory space is also divided by CELLs, which hold a value. Sometimes the cells of an array are called SLOTs. Below is a picture of an array.

Array Elements
Array Elements

Grab The Button...

Grab the above button and add to your blog or website to get easy access to Virtual Species. Simply click the textbox, copy the code and paste where you want to see the button. That's it!