Arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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
0 Answers