#与0的区别:

#:没有则为空

0:没有则补0

 

final DecimalFormat df = new DecimalFormat("0.##");
        final String str1 = df.format(a);

final DecimalFormat df = new DecimalFormat("0.00");
        final String str1 = df.format(a);

执行结果:

3.1

3.10
参考:new DecimalFormat("0.##")与new DecimalFormat("0.00")的区别

相关文章:

  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2021-12-23
  • 2021-08-17
猜你喜欢
  • 2021-11-27
  • 2021-05-31
  • 2022-12-23
  • 2021-07-13
  • 2021-05-30
  • 2022-12-23
  • 2021-11-23
相关资源
相似解决方案