educative.io

Educative

https://www.educative.io/courses/learn-java-from-scratch/JYE4Xr9BpEJ

I’m a bit confused on this solution, if this question even goes to the right spot. The solution for this problem has the answer being printed in the for-loop cycle. However, the practice problem made me save the string to be returned, which is a completely different set-up/solution. For my solution, I had to look up Integer.toString(), which I never saw in the lesson. Was the function returning the string intentional, or was it supposed to print()?

Hi Ryan!

The challenge requires you to save the values to a string and return it rather than printing it to the console. The solution has been updated to return the answer instead of printing it!

Regarding the conversion of data types, the lesson mentions the valueOf() method of String to convert the computed value from integer to string.