System.out.println(tree.item +"\t\t\t"+tree.list);
as [26, 27, 38] associated [1] at [17, 18] attack [10]
但我想要像这样打印
as [26, 27, 38] associated [1] at [17, 18] attack [10]
答案 0 :(得分:1)
我无法访问您想要的代码,但我建议您使用 - 这意味着基本上留下缩进
String[] item = new String[] { "Audi", "BMW", "VW", "Ferrari", "Cherry QQ" };
float[] price = new float[] { 18000.0f, 24000.0f, 2100.50f, 786400.1f, 120.70f };
for (int i = 0; i < price.length; i++) {
System.out.printf("%2d. %-10s €%.2f\n", i + 1, item[i], price[i]);
}
结果看起来像
一样左对齐