I have two methods that when prompted by the user will print out n amount of String on m rows, for ex: * 3 3 would print out:
***
***
***
here is the code I have:
public static void writeLine(String c, int n)
{
if(n==0)
System.out.println();
else
System.out.print(c);
writeLine(c, n-1);
}
public static String writeBlock(String c, int m, int n)
{
if (m==0)
System.out.println();
else
writeLine(c, n);
return (writeBlock(c, m-1, n));
}
what is happening is if I put in * 3 3 I get:
***
**************************************... will keep going) the first line is right, it prints out the correct number, but then it just goes to a new line and prints indef.
Can anyone tell me where I went wrong?