+ 1
Can you help me with this Java Array Program?[Solved]
Hi, I can't understand why it's not working. Please help me. https://code.sololearn.com/cB4vH9wtXY4C/?ref=app
3 Respuestas
+ 2
It throw an error here
m[i]=sc.nextDouble();
Why?
You try to use a double type variable as array index. The index is integral value. A array index of 1.25 is invalid for example.
How to solve it?
You can cast the double to int m[(int)i] or change type of i from double to int
+ 4
It's Roy declare i as int not double . as array index are of type int.