When to use String.valueOf

I just wanted to know why I did not have to use String.valueOf() method when I entered my solution I just used System.out.println() to print all the variables I declared and the test passed. I was surprised to see the String.valueOf() used in the solution given.

The String.valueOf() function just converts the value to string format before printing. Either way is fine though.