add advantages and disadvantages of array (#20768)
* add advantages and disadvantages of array add two advantages and 1 disadvantages of array to the article. * add advantages and disadvantages of array updated the previous commit.
This commit is contained in:
@ -179,5 +179,12 @@ Output:
|
||||
[ 0 | 1 | 2 | 3 | 4 ]
|
||||
```
|
||||
|
||||
**Advantages of Arrays**
|
||||
- **Code Optimization**: It makes the code optimized, we can retrieve or sort the data efficiently.
|
||||
+ **Random access**: We can get any data located at an index position.
|
||||
|
||||
**Disadvantages of Arrays**
|
||||
- **Size Limit**: We can store only the fixed size of elements in the array. It doesn't grow its size at runtime. To solve this problem, collection framework is used in Java which grows automatically.
|
||||
|
||||
#### More Information:
|
||||
* Source: [Java Arrays](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html)
|
||||
|
Reference in New Issue
Block a user