Java Arrays

j
Java Arrays:

Creating Arrays:

The array elements are accessed throughthe index.Array indices are 0 based; that is, they start from 0 to arrayRefVar.length-1
double[] myList=new double[10];

Output:

foreach loops

Output:

Passing Arrays to Methods:

Returning an Array from a method:

The array class:

java.util.arrays for soritng and searching arrays,comparing and filling arrays.
public static int binarySearch(Object[] a,Object key)

public static boolean equals(long[] a1,long[] a2)

public static void fill(int[] a,int val)

public static void sort(Object[] a)