import java.util;
public class Compact
{
public static int[] randomArray (int n)
{
int[] a = new int[n];
for (int i = 0; i < a.length; i++)
{
a[i] = Math.random();
}
return a;
}
public static double[] printArray (double[] a)
{
for (int i = 0; i<a.length; i++)
{
return a[i];
}
}
public static void main(String args[])
{
System.out.prin tln("Test for printing " + printArray(a));
}
}
In the above code, what I am trying to do is create an array with random integers. The size of the array is 20. I don't know how to call the array...
public class Compact
{
public static int[] randomArray (int n)
{
int[] a = new int[n];
for (int i = 0; i < a.length; i++)
{
a[i] = Math.random();
}
return a;
}
public static double[] printArray (double[] a)
{
for (int i = 0; i<a.length; i++)
{
return a[i];
}
}
public static void main(String args[])
{
System.out.prin tln("Test for printing " + printArray(a));
}
}
In the above code, what I am trying to do is create an array with random integers. The size of the array is 20. I don't know how to call the array...
Comment