130k views
0 votes
What is an advantage of using arrays instead of simple variables?

User Mugetsu
by
6.1k points

2 Answers

6 votes

Answer: It reduces the amount of code used in the program.

Step-by-step explanation:

What is an advantage of using arrays instead of simple variables?-example-1
User Shorol
by
5.6k points
3 votes

Arrays allow you to do more complex things. They also allow you to store variables in groups to make them easier to retrieve. Arrays can also be useful if you want to use for-loops. For example, if you wanted to have a bunch of variables for dog names you could use an array for that to find them easily.

String[] dogNames = {"Max", "Simba", "Bailey", "Bolt"};

User Shanthakumar
by
6.3k points