Within a method, I have the following code:
s = s + (items[i] + ":" + numItems[i]+" @ "+prices[i]+" cents each.\n");
Which outputs:
Candy: 5 @ 50 cents each.
Soda: 3 @ 10 cents each.
and so on . . .
Within this line, how do I get the 5, 3, etc . . to line up with each other so that it is:
Candy: 5 @ 50 cents each.
Soda: 3 @ 10 cents each.
This is part of a toString()
method, so I can't do it with a System.out.printf