I am trying to create two Arrays in main then call a method where the values of the first array(which I randomized) are copied to the second array,I am getting stuck at calling the method and passing. I am lost on how to call and pass arrays any help would be appreciated.
class C9hw5
{
public static void main(String[] args)
{
int[] ar = new int[10]; // random array
int[] at = new int[10]; // array two
Random r = new Random();
for(int i = 0; i < ar.length; i++) // initializing it to random
ar[i] = r.nextInt();
System.out.println("The random array displays");
for(int i = 0; i < ar.length; i++)
System.out.println( ar[i]);
copyArray();
}
public static void copyArray(int ar[], int at[])
{
for (int i = 0; i < at.length; i++)
at[i] = ar[i];
}
}
}