I'm trying to get a single line to output and look somewhat like this:
1 2 3 4 5 6 7 8 9
Adding another space every time the number increases. I need to do it using for loops, with a nested for loop being preferred. Here's my code so far (on run it doesn't print even with the method call.)
public static void outputNine()
{
for(int x=1; x<=9; x++)
{
for(char space= ' '; space<=9; space++)
{
System.out.print(x + space);
}
}
}
I know I'm doing something wrong, but I'm fairly new to java so I'm not quite sure what. Thanks for any help.