System.out.printf("%7s", "a");
System.out.printf("%7s", "b");
System.out.printf("%7s", "c");
System.out.printf("%7s", "d");我只想给字符串7个空格。有没有更好的方法来打印它而不需要4个新的printf()?
发布于 2011-11-11 12:19:38
System.out.printf("%7s%7s%7s%7s", "a", "b", "c", "d");发布于 2011-11-11 12:20:38
您正在打印...%d
char first = 'a';
char second = first + 1; // will be b因此您可以使用for循环并避免重复
https://stackoverflow.com/questions/8089614
复制相似问题