Help in printing the result of the for loop
I am having a problem while writing this java for loop code. I am trying to print "NETProduct" a number of times which is depending on the passed "length" variable and to print after the word "NETProduct" the current value of the length + " ," and when it reached the last "NetProduct", it shoudn't produce "," after the "NETProduct" variable.
As an example:
So, what I am looking for is for the result:
String sentence = "";
int length = 4;
for ( i = 1 ; i <= length ; i++)
sentence = "NETProduct" + i + ",";
and the result is in the same line.
Can you please help