What is the advantages and disadvantages of array in Java?

Total Post:83

Points:415
Java 
 2633  View(s)
Ratings:
Rate this:
  1. Post:83

    Points:415
    What is the advantages and disadvantages of array in Java?

    There are several advantages and disadvantages of the array in java. Advantages and Disadvantages of Array in Java are as follows:

    Advantages of the array in Java:

    1. In Java, we can able to access any element randomly by using index number provided by arrays.

    2. In Array, we can store many numbers of elements at a time.

    3. It's fast because primitive type to wrapper classes object conversion will not happen in Array.

    Disadvantages of the array in Java:

    1. In Java, Arrays are Strongly Typed.

    2. In Array, we can't able to add or remove methods.

    3. An array having a fixed length, we need to initialize the size of the array.

    4. Due to a fixed length, there is a chance of memory wastage.

    5. When we want to delete an element in the array we need to traverse throughout the array so this will reduce performance.


Answer