+ 1
Bug on "Java for Beginners Module 3 Quiz"
while using the sololearn app I came across this question "What's the output of this code?" "int arr[ ] = new int[3]; for (int i = 0; i < 3; i++) { arr = i; } int res = arr[0] + arr[2]; System.out.println(res);" Is that an error right? Can someone fix this please?
5 Antworten
+ 3
i have reported this issue on 01.11.2024 to sololearn.
on 07.11.2024, i got an answer that the issue is fixed.
+ 2
report to info@sololearn.com.
you can update the course by restarting it.
+ 1
The right way to assign i to the array in the loop would have been.....
arr[i] = i;
...and then the output would have been 2
0
Jan I know. I didn't make this code, the app gave me that code to find the output.
0
Lisa Ok thank you. I will report that.