I tried to print an array with random numbers from 100 to 500 by using System.out.print(); but nothing has shown and when I tried using println it wasn't organized. So, how can I organize it to print 10 elements per row by using System.out.println();
And also, when I return the array it returns the location like [I@7de26db8, how I can fix that?
public int [] randomS() {
Random rand = new Random();
int a[] = new int[10000];
for(int i=0; i<a.length; i++)
{
a[i] = rand.nextInt(500-100)+100;
System.out.print(a[i]+" ");
}
return a;
}
Aucun commentaire:
Enregistrer un commentaire