- #1
courtrigrad
- 1,236
- 2
Hello all
My program is trying to print out a square but it is not working. I figure something is wrong with the spacing.
Any help is greatly appreciated
Thanks!
My program is trying to print out a square but it is not working. I figure something is wrong with the spacing.
Code:
public class Box
{
public void getBox( int a )
{
for( int i = 0; i < a; i++)
{
for( int j = 0; j < a; j++)
{
if( i == 0 || i == a-1)
System.out.print("x");
else
if( j == 0 || j == a-1)
System.out.print("x");
else
System.out.print( " " );
}
System.out.println( " " );
}
}
}
Any help is greatly appreciated
Thanks!