You are viewing a single comment's thread. Return to all comments →
I understand what you did for the first and second method. But can you please explain what does 3rd method do. In other words, how does "" convert integer into string? Thanks
We know that "" is of type String. It is known as the empty string. It is a String with no characters in it. The + operator, when used on the right side of a String, simply connects stuff to the right of the original String. If what it's connecting is not yet a String, it automatically converts it into one, which is what we want for this exercise.
"" + "Hello" + "there."
becomes the String "Hello there." and
"" + n
becomes the String n, where n was automatically converted into a String for us.
Thank you very much
3rd one was simple and smart.
yes ,im also ,2&3 rd class gives some confusion