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.
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:
- Here is the all possible ways of printing arrays in java.
- 5 Different ways to print arrays in java
Creating array of objects in java:
- We can create array of objects in java.
- Check out this interesting article about array of objects in java computer programming.
- Creating array of objects in java example program
Java program to find missing numbers in an array:
- We can find missing numbers in java array lets see the below example program.
- Java Program to find missing numbers in an array
Find second highest number in java arrays:
- Check this below post about how to find second highest number in an array.
- Find second highest number in an integer Array
Convert arrayList to array:
Copy all elements of hash set to Object array: