print multiple lines

I am trying to figure out the best way to do the following problem. However i don't have any good idea. Thanks for your help.

//write a recursive Java method writeBlock that uses writeLine to write m

// lines of n characters. for example, writeBlock ('*' , 5 ) produce the

line *****.

[313 byte] By [jorgebrito02@msn.coma] at [2007-11-26 17:21:21]
# 1

> for example, writeBlock

> ('*' , 5 ) produce the

> line *****.

public void writeBlock(char ch,int m)

{

for(int i=0;i<m;i++)

System.out.println(ch);

}

Put this inside your main method.Don't forget the dukes.>

qUesT_foR_knOwLeDgea at 2007-7-8 23:49:21 > top of Java-index,Java Essentials,New To Java...
# 2

> > for example, writeBlock

> > ('*' , 5 ) produce the

> > line *****.

>

> > public void writeBlock(char ch,int m)

> {

> for(int i=0;i<m;i++)

> System.out.println(ch);

> }

>

>

> Put this inside your main method.Don't forget the

> dukes.

Maybe I'm crazy, but I don't quite see the recursion here.

kevjavaa at 2007-7-8 23:49:21 > top of Java-index,Java Essentials,New To Java...
# 3

> > > for example, writeBlock

> > > ('*' , 5 ) produce the

> > > line *****.

> >

> > > > public void writeBlock(char ch,int m)

> > {

> > for(int i=0;i<m;i++)

> > System.out.println(ch);

> > }

> >

> >

> > Put this inside your main method.Don't forget the

> > dukes.

>

> Maybe I'm crazy, but I don't quite see the recursion

> here.

And I have overlooked the word recursive in his post.****

qUesT_foR_knOwLeDgea at 2007-7-8 23:49:21 > top of Java-index,Java Essentials,New To Java...
# 4

public class test

{

public static void main(String args[])

{

writeBlock('*',6);

}

public static void writeBlock(char ch,int m)

{

if(m==0)

return;

writeBlock(ch,m-1);

System.out.print(ch);

return;

}

}

qUesT_foR_knOwLeDgea at 2007-7-8 23:49:21 > top of Java-index,Java Essentials,New To Java...
# 5
don't forget the dukes
qUesT_foR_knOwLeDgea at 2007-7-8 23:49:21 > top of Java-index,Java Essentials,New To Java...
# 6
> don't forget the dukesNot quite there yet. Did you notice "to write m lines of n characters"?PS It might be a good idea to let the op put some effort into it =)
duckbilla at 2007-7-8 23:49:21 > top of Java-index,Java Essentials,New To Java...
# 7
> Put this inside your main method.Don't forget the> dukes.Quest, please stop helping people to cheat. You have seen the reasons why it is discouraged here before.
zadoka at 2007-7-8 23:49:21 > top of Java-index,Java Essentials,New To Java...
# 8

> Quest, please stop helping people to cheat. You

> have seen the reasons why it is discouraged here

> before.

Even I discourage people doing someone else's homework.Blame it on the dukes.It's better Sun gets rid of that star at the top.A serious distraction!Sometimes when i am high on duke drugs i can't resist.

qUesT_foR_knOwLeDgea at 2007-7-8 23:49:21 > top of Java-index,Java Essentials,New To Java...
# 9

> > Quest, please stop helping people to cheat. You

> > have seen the reasons why it is discouraged here

> > before.

>

> Even I discourage people doing someone else's

> homework.

I guess that makes you a hypocrite.

> Blame it on the dukes.

Rather that you take responsibility for your own actions. Of course.

>It's better Sun gets

> rid of that star at the top.A serious

> distraction!Sometimes when i am high on duke drugs i

> can't resist.

Duke Drugs? Now you are just making things up.

zadoka at 2007-7-8 23:49:21 > top of Java-index,Java Essentials,New To Java...