两种方式
System.out.println(MessageFormat.format("{0}-{1}",1,2));
System.out.println(String.format("%d-%d",1,2));

 注意如果是4位以上的数比如1234,MessageFormat显示的是1,234.需要使用{0,number,#}格式化

相关文章:

  • 2021-11-17
  • 2021-09-25
  • 2022-01-05
  • 2021-07-24
  • 2022-12-23
  • 2021-08-24
猜你喜欢
  • 2021-11-11
  • 2021-11-17
  • 2021-12-18
  • 2022-12-23
  • 2021-09-30
相关资源
相似解决方案