Advertisement

JAVA中System.out.println与System.out.printf有何不同?

阅读量:

在日常的编程实践中,我们通常依赖System.out.println或System.out.print这类语句来实现代码的输出功能。

printf???对于学习过C语言的开发者而言,这个输出相关的关键词应当并不陌生。

那么Java中的System.out.printf又是什么呢???

似乎此前并未深入思考过这个问题。不妨追溯其起源:

这些方法均属于PrintStream类所包含的函数。

printf函数源码解析

复制代码
     /** * A convenience method to write a formatted string to this output stream
    
      * using the specified format string and arguments.
    
      * * <p> An invocation of this method of the form <tt>out.printf(format,
    
      * args)</tt> behaves in exactly the same wa

全部评论 (0)

还没有任何评论哟~