Array:
Under the name of a common variable, the data stored in memory of the same type stored in memory is called array. The array is the number of variables set in the same type. Array variables can save multiple data in the same name, same type. Array is a derived data type. Before using the variable declaration, it is necessary to declare array variables with data types. The array declaration format is in Java:-
DataType ArrayName[];
ArrayName = new DataType[ ArraySize ];
The above two statements are also written together in this way:-
DataType ArrayName[] = new DataType[ ArraySize ];
DataType ArrayName[] = new DataType[ ArraySize ];
Here, DataType is any build-in or custom data type, ArrayName is give programmer any accept name and ArraySize is published of integer any constant name. The name of the variable is an identifier. So valid names of variables can be given. Array size is defined in the third bracket [] of adjacent arrays. Which indicates the number of data in the array variable. This number is called array index and each distinct array of arrays is called an array element separately.
Example :-
char name[] = new char[20];
int roll[] = new int[10];
float mark[] = new float[5];
Example :-
char name[] = new char[20];
int roll[] = new int[10];
float mark[] = new float[5];
0 comments:
Post a Comment