I'm trying to work on a random number generator where the user can determine the amount of numbers. This piece below has had me stumped for the last few hours.... It is not the complete program, but I can provide that if needed.
I keep receiving the "error:'void' type not allowed here message on line 02 when I try access my 'printArray' method and I'm not sure why. Any nods in right direction would be greatly appreciated. This is only the 4th time I have had to write a program!
listSize = input.nextInt();
printArray(generate_data(listSize));
}
}
public static void generate_data(int size){
int [] randomArray = new int [size];
for (int i=0; i<randomArray.length; i++){
randomArray[i] = 1+(int)(Math.random()*9999);
}
}
public static void printArray(int[]s){
for(int i = 0; i<s.length; i++){
System.out.print(s[i] + " ");
}
}

New Topic/Question
Reply



MultiQuote



|