问题描述:

I am trying to create my output to look like a table in Java. Is it possible to create a standard format that I use for all my output? So far I have?

String format = String.format("%-3s%-3s\n");

System.out.printf(format, "foo", "bar");

When I am currently trying this with different input and creating my format for use within a for loop I am getting an error saying:

Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier '%-3s'

Any help is greatly appreciated.

相关阅读:
Top