array examples | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

array examples

17th Jul 2016, 7:52 AM
sky
sky - avatar
5 Answers
+ 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...
17th Jul 2016, 10:46 AM
FreakManMega
+ 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....
21st Jul 2016, 1:59 PM
Harshil Soni
Harshil Soni - avatar
+ 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.
22nd Jul 2016, 11:20 AM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 2
FreakManMega good code examples
22nd Jul 2016, 11:27 AM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 2
Thanks Joe!!!
22nd Jul 2016, 11:55 AM
FreakManMega