【问题标题】:What does the format %10.2 mean when included in a printf statement?当包含在 printf 语句中时,格式 %10.2 是什么意思?
【发布时间】:2016-01-17 06:53:24
【问题描述】:

当包含在 printf 语句中时,格式 %10.2 是什么意思? 在一次采访中被问到我没有回答

【问题讨论】:

    标签: format format-specifiers


    【解决方案1】:

    我希望这个答案对你有所帮助。实际上你的格式应该是 "%10.2f" 而不是 "%10.2" 。

    浮点数格式。

    public class HelloWorld{
    
     public static void main(String []args){
        System.out.printf("%10.2f",15.2);
        System.out.println();
     }
    

    }

    【讨论】:

      猜你喜欢
      • 2018-07-14
      • 1970-01-01
      • 2011-11-18
      • 1970-01-01
      • 1970-01-01
      • 2011-08-15
      • 1970-01-01
      • 2021-10-06
      • 1970-01-01
      相关资源
      最近更新 更多