+ 1
Why this code doesn't go?
I want to print this,using Array: 123 456 789 But there is an error: https://code.sololearn.com/cVWFP8s3iIoE/?ref=app It just prints first two numbers, why? Can anyone help me please?
1 Respuesta
+ 3
Your nil=sc.nextLine(); is inside the for loop. So it wants 10 lines instead of 3.
So when you type:
123
456
789
You'll get an error because you only gave 3 lines.
Try getting the input from outside the loop and store them in an array.