你能告诉我有没有其他方法可以在 System.out.printf 之间换行 - 标准输出函数我希望它是相关的问
package formattedoutput;
public class FormattedOutput {
public static void main(String[] args) {
double amount;
amount = 43.676;
int spaces;
spaces = 77;
System.out.printf( "%1.2f", amount );// the "2" in 1.2 specifies the number of digits to use after the decimal point.
System.out.println();
System.out.printf("%12d", spaces ); // specifies the minimum number of spaces that should be used for the output. If the integer that is being output takes up fewer than 12 spaces, extra blank spaces are added in front of the integer to bring the total up to 12.
}
}