I've
just started learning Java this week. Feel free to laugh, I can take it.
So, I'm doing this 9x multiplication table, as an exercise:
class table9x9
{public static void main(String args[])
{for(int x = 1; x <= 9; x ++)
{ System.out.print(x + "\t");
for(int y = 2; y <= 9; y ++)
{
System.out.print(x * y + "\t");
}
System.out.println();
}
}
}
Questions... 1) Is this the most elegant way to achieve the results? E.g. I'm not sure about initializing y as 2 (although it does the job)...
2) Is it better to initialize x & y
outside of the for loops? Or is that irrelevant?
3) When I run this, the single digit "answers", top-left of the table, do not align evenly. I cannot for the life of me understand why not!
4) My dos shell "copy" button: how do I enable that? Y'know, so I can show the result.
Any help would be appreciated. I've gotta lot of learning to do. Thanks!