Reputation: 157
How would I convert System.out.printf("%3s", "");
to a .print()
in Java? And also
System.out.printf("%3d\n", (i - startDay));
.
Upvotes: 1
Views: 266
Reputation: 15408
use String.format(String format, Object... args)
:
System.out.print(String.format("%3s", ""));
And:
int i = 50;
int startDay = 20;
System.out.print(String.format("%3d\n", (i - startDay)));
Upvotes: 6