Results 1 to 2 of 2
- 05-11-2011, 05:14 PM #1
Member
- Join Date
- Jul 2010
- Posts
- 27
- Rep Power
- 0
Help in printing the result of the for loop
Dear All,
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:Java Code:String sentence = ""; int length = 4; for ( i = 1 ; i <= length ; i++) { sentence = "NETProduct" + i + ","; }
NETProduct1,NETProduct2,NETProduct3,NETProduct4
and the result is in the same line.
Can you please help
- 05-12-2011, 09:30 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,470
- Rep Power
- 16
Similar Threads
-
Printer loop the same printing
By kiki2009 in forum Advanced JavaReplies: 2Last Post: 04-29-2011, 05:43 PM -
problem with if statement in while loop of result set
By kishan.java in forum New To JavaReplies: 6Last Post: 04-09-2011, 04:07 PM -
Printing a table with a for loop help
By shroomiin in forum New To JavaReplies: 2Last Post: 10-31-2009, 01:47 AM -
Printing a table with a for loop help
By shroomiin in forum New To JavaReplies: 1Last Post: 10-31-2009, 01:41 AM -
Problem printing inside FOR loop
By cassysumandak in forum New To JavaReplies: 1Last Post: 10-04-2009, 05:02 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks