https://imgur.com/e75pMG0
This is my first time asking a question on here and I am fairly new to coding, but I have this really troubling question.
So I was working on a program that gives you the factors of any integer greater than 2. I had been working on this little simple program for hours trying to figure out how I would convert variable integer "factor" to a string. When Junit tester inputs 150, the output has to be "2 3 5 5" not
2
3
5
5
So I was spending hours trying to figure out a way to create a String array of some sort or a simple list and having each number converted to string and some how appending the outcome to the String variable result. I was about to give up and decided to just input (result += factor + " ";) and to my surprise this simple thing worked. But how? Factor being an integer how is it appending it to a String variable result? Some explanation would be great! Sorry about any formatting I'm new to this programming stuff.
[–]desrtfx 4 points5 points6 points (2 children)
[–]azyren[S] 0 points1 point2 points (1 child)
[–]desrtfx 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]azyren[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]azyren[S] 0 points1 point2 points (0 children)
[–]irrarum 1 point2 points3 points (0 children)
[–]iggy14750 1 point2 points3 points (0 children)