+ 13
Where does the Array use in java
Usage of java
10 Answers
+ 32
Arrays are used for storing and manipulating variables of the same type. If you mean the Arrays class it has some very useful methods, such as sorting - sort(), comparing the values - equals(), turning an array to a string - toString() and I'm sure a lot more that I don't know of yet :))
+ 13
When you need to use lot of data,same data type & update, delete & modify that time you use Array or array list.You must be import array or arraylist.Array class have an lot of method , you call this method for data upadate or modify,delete.You just practice it, then you will realise.
+ 7
Extra information:
- you can store multiple variables of the same type
- different types is not allowed
- length of an array is immutable
+ 7
Basically, you are asking for the "situation", where you should use arrays.
So, the answer is quite simple. The answer is: -
1.when you have to store multiple values without using multiple variables.
2.when you have to manipulate some kind of data which has a same data type.
3.Also, for other reasons, can be used to analyze data.
Basically, you use it to store a 'set' of data which have the same data type.
+ 6
For example, in each frame of a platform game, when you are performing collision test on player and each of the enemies, you will use loop running on an array of enemy objects.
+ 5
Note that elements in the array are identified with zero-based index numbers, meaning that the first element's index is 0 rather than one. So, the maximum index of the array int[5] is 4.
+ 3
When you have to deal with lots of same data type, you will really need it! Like you want to create and store some numbers like factorials or Fibonacci series.
+ 2
When your program needs to store much more data that has same data type which is necessary to modify.
+ 2
So that you don't need to declare multiple variables what will you do if you want to take 100 inputs and find there average
+ 2
....