+ 1
How arrays can be useful and where it is used ?
6 Answers
+ 2
arrays can be used to store a number of values of same type in a single name
+ 2
An array is a way of placing values into an indexed list. Let's say you have a bunch of names you need to store in your program. You can create a variable for each name(name1 = "Bob", name2 ="Rick" etc.. which is a lot of variables to deal with or you can simplify it by putting them in an array. String[] names = new String[number of names]; Each name you add will index starting at 0 all the way to the max number you set. Can easily cycle through them all with a for loop for easy printing or just make changes without accessing a different variable each time
+ 2
lets say you wanted to calculate the average score for a test. Instead of making a variable for each student, you could make an array with one variable to hold all the test scores. you can then loop through the array adding all the values. divide by the length of the array. bam average score on test.
0
not proper answer
0
Thanks guys . Like my question plZ
0
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....