Question | Answer |
What are arrays? | Arrays are data structure to store the data of the same data type |
element of an array | individual units of an array |
array index | index number starting from 0 in which order the array elements are arranged consecutively in the memory location |
name of the array | a reference variable to store the location where the first element of the array is stored. |
for(int i=0; i<arrayname.length; i++) { ------ } | for next loop or enhanced for loop |
for(String s: name) { ---- } | for each loop |
for each loop | used to retrieve elements without accessing to individual elements |
for next loop for arrays | used when you need to access a particular element through its index |
arrayName.length | gives the total number of elements in an array named arrayName. |
array can store the | primitive data types objects |
an array can store only | the same data type that means all the elements of an array should be of the same type |
arrayName[5] refers to the | 6th element of the array |
apart from primitive data types arrays can also store | objects |
Want to create your own Flashcards for free with GoConqr? Learn more.