0

Arrays

So Iā€™m trying to work an array in which the first position [0] is a Scanner integer. Thus far, Iā€™m returned with the error along the lines ā€œvariable might not be initializedā€. Any explanations/solutions? And also, how would one go about printing an entire array? I was thinking System.out.println(array[]) but Iā€™m not sure. The code is having trouble saving so here is the array portion copy and pasted: ... int[] a; Scanner inp = new Scanner(System.in); int in= inp.nextInt(); a[0] = in; ...

8th Jul 2018, 1:37 AM
Michael
Michael - avatar
1 Answer