丶Gatsby 2017-11-15 11:55 采纳率: 100%
浏览 1374
已采纳

java中的System.out.format("c1=0x"+"x%",c1)的注释该怎么写?

java中的System.out.format("c1=0x"+"x%",c1)的注释该怎么写?
java中的format用法有哪些啊,什么情况下可以用?

  • 写回答

1条回答 默认 最新

  • kalin-kalin 2017-11-15 11:58
    关注

    long n = 461012;
    System.out.format("%d%n", n); // --> "461012"
    System.out.format("%08d%n", n); // --> "00461012"
    System.out.format("%+8d%n", n); // --> " +461012"
    System.out.format("%,8d%n", n); // --> " 461,012"
    System.out.format("%+,8d%n%n", n); // --> "+461,012"

      double pi = Math.PI;
      System.out.format("%f%n", pi);                 //  -->  "3.141593"
      System.out.format("%.3f%n", pi);               //  -->  "3.142"
      System.out.format("%10.3f%n", pi);             //  -->  "     3.142"
      System.out.format("%-10.3f%n", pi);            //  -->  "3.142"
      System.out.format(Locale.FRANCE,
                        "%-10.4f%n%n", pi);          //  -->  "3,1416"
      Calendar c = Calendar.getInstance();
      System.out.format("%tB %te, %tY%n", c, c, c);  //  -->  "May 29, 2006"
      System.out.format("%tl:%tM %tp%n", c, c, c);   //  -->  "2:34 am"
      System.out.format("%tD%n", c);                 //  -->  "05/29/06"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料