Stuck on this, need to create a method that prints n x n box:
**** * * * * ****
The spaces between the middle two stars is two.
Here's my code:
public static void starBox(int n) { for (int row = 1; row <= n; row++) { for (int col = 1; col <= row; col++) { if (row == 1 || row == 4) { System.out.print("* "); } else { System.out.print("* "); } System.out.println(); } } } }
But I get this:
* * * * * * * * * *
Can anyone give me hints or tips as to what I'm doing wrong? Thanks!