| Author |
how to print a christmas tree?
|
Lim Youjie
Greenhorn
Joined: Dec 27, 2004
Posts: 22
|
|
hi, im a newbie to java. this program allows the user to input the height of the christmas tree. but i m not sure of the codings for the loop. e.g the height indicate by user is 4 * *** ***** ******* e.g the height indicate by user is 3 * *** *****
|
 |
Martyn Clark
Ranch Hand
Joined: Apr 16, 2005
Posts: 108
|
|
|
Hi Lim i don't quite understand what you are trying to do with the loop and user input can you explain a little better or post some code.
|
Martyn...<br /> <br />SCJP 1.4 SCWCD 1.4
|
 |
Lim Youjie
Greenhorn
Joined: Dec 27, 2004
Posts: 22
|
|
|
|
 |
Seb Mathe
Ranch Hand
Joined: Sep 28, 2005
Posts: 225
|
|
using char ast = '*'; you can do : char[] line = new char[2*i-1]; java.util.Arrays.fill(line, c); System.out.println(line); [ October 11, 2005: Message edited by: Seb Mathe ]
|
Regards,<br />Seb<br /> <br />SCJP 1.4
|
 |
Lim Youjie
Greenhorn
Joined: Dec 27, 2004
Posts: 22
|
|
may i know wats c? thanks
|
 |
Lim Youjie
Greenhorn
Joined: Dec 27, 2004
Posts: 22
|
|
thanks think i understand Martyn Clark and Seb Mathe. you guys are great.
|
 |
Seb Mathe
Ranch Hand
Joined: Sep 28, 2005
Posts: 225
|
|
oops, "c" is "ast" char c = '*';
|
 |
 |
|
|
subject: how to print a christmas tree?
|
|
|