Why not use java.util.Array s? You're importing it:
[CODE=java]import java.util.Array s;
public class Compact {
public static void main(String[] args) {
int a[] = new int[20];
for (int i = 0; i < a.length ; i++) {
a[i] = (int)(Math.rand om() * 10);
}
System.out.prin tln("The random array is: "
+ Arrays.toString (a));
}
}[/CODE]
The reason you were not getting the right output before is because the toString method for arrays doesn't output their contents.
[CODE=java]import java.util.Array s;
public class Compact {
public static void main(String[] args) {
int a[] = new int[20];
for (int i = 0; i < a.length ; i++) {
a[i] = (int)(Math.rand om() * 10);
}
System.out.prin tln("The random array is: "
+ Arrays.toString (a));
}
}[/CODE]
The reason you were not getting the right output before is because the toString method for arrays doesn't output their contents.
Comment