//0代表前面的补充
//8代表长度为8
//d代表参数类型为正整数
int val=12;
System.out.println(String.format("%08d", val));
打印结果:
00000012
System.out.println(String.format("你是谁?%2$s,他是谁%1$s", "wj","jw"));
你是谁?jw,他是谁wj
//0代表前面的补充
//8代表长度为8
//d代表参数类型为正整数
int val=12;
System.out.println(String.format("%08d", val));
System.out.println(String.format("你是谁?%2$s,他是谁%1$s", "wj","jw"));