Here are 3 ways to convert an int to a String String s = String.valueOf(n); String s = Integer.toString(n); String s = "" + n; I understand what we did for the first and second methods. But can someone please explain what does 3rd method do? In other words, how does "" convert integer into string? Thanks
Hey, @tombezlar Are you sure that the 3d method is needed in that case? As far as I understood, it's a combo of an empty string and "n" (in a nutshell). The function is the same as in both above.
I guess that you may dig deeper into the topic if needed, for example, check some articles on CodeGym blog. However, this one isn't the easiest part of Java, for sure.