+ 1
array examples
5 Respostas
+ 2
int[] array1 = new int[6];
array1[0] = 12;
array1[1] = 33;
...
array1[5] = 6;
int[] array2 = new int[] {12, 33, , , , 6};
float[][] array3 = new float[3][6];
array3[0][0] = 5.5F;
...
String[][] array4 = new float[][]{{"Don", "Max", "Steven"}, {"", ""}, {""}};
... I think that's enough...
+ 2
if you are looking for a real life example-
Imagine a librarry containing books of different genres.
then it there will be different cupboard for different genres.
like novel in one, biographies in second....
if tge lybrary has got a new novel it will store it in first cupboard...
in array...data type is that genre...and related syntex is cupboard....
hope it will help you....
+ 2
egg container with slips of paper. each slip has a number on it and is in one egg holder in the carton. The holders are the indices and the slips of paper are the values. you can reorder them different ways by moving the pieces of paper into different egg holders within the carton. The indices (compartments in the carton) stay the same,
Hope this helps. Harshils answer is very good, thank you.
+ 2
FreakManMega good code examples
+ 2
Thanks Joe!!!