Search This Blog

Friday, July 24, 2015

Arrays

Arrays:-

An array is a data structure containing a group of values of the same data type.
 For instance, an array can accept a group of String values, a group of int values, 
or a group of boolean values. As long as all of the values are of the same data type,
 they can go into the same array.

Arrays are characterized by a pair of square brackets. When you declare an array in Java,
 you can put the brackets either after the identifier or after the data type:

int  studentID[];
char[]  grades;

Note that the array size is not specified. 
Declaring an array does not allocate memory for that array. 
In most other languages the array’s size must be included in its declaration,
 but in Java you don’t specify its size until you use it. Then the appropriate memory is allocated. 

@adsbygoogle