» » » Advantages and disadvantages of arrays in java


Disadvantages of array in java
  • Arrays are Strongly Typed.
  • Arrays does not have add or remove methods.
  • We need to mention the size of the array. Fixed length.
  • So there is a chance of memory wastage.
  • To delete an element in an array we need to traverse through out the array so this will reduce performance.



Advantages of arrays:


  • We can access any element randomly by using indexes provided by arrays.
  • Primitive type to wrapper classes object conversion will not happen so it is fast.
  • Array can store many number of elements at a time.



Arrays in java   InstanceOfJava

Java interview programs on arrays:

  • Check below for some of the interesting java interview programs on arrays.

Five different ways to print arrays in java:



Creating array of objects in java:



Java program to find missing numbers in an array:



Find second highest number in java arrays:




Convert arrayList to array:

Copy all elements of  hash set to Object array:


Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu