I understand your apprehension, and that is the reason I have not asked for codes, just for hints. First, I know how to generate this pattern without using 'for' loop, which is tedious and not the right way. Second, I can create a nested 'for' loop and generate the following pattern: **** **** **** But I do not know, how to increase the '*' in subsequent line. I would appreciate any hint in this regard.
Use the concatentation operator bob is of type STRING. bob = bob + "*"; OR its shorthanded equivalent bob += "*"; OR a funkier way to do it is by way of: System.out.print("*") this will print a string and won't wrap to the next line. I'd recommend figuring out how to do it using the first way. [ July 14, 2003: Message edited by: Eric Hoskland ]
posted 15 years ago
Thanks Friend! I have got it. I have used String X ="X"; and X =X +"X"; It has worked.
With a little bit more thought, I'd bet you could figure it out, without using String concatenation (not that there's anything really wrong with such a solution). Think "nested for loops", as you once did.