System.out.printf与System.out.format [英] System.out.printf vs System.out.format

查看:97
本文介绍了System.out.printf与System.out.format的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

System.out.printf System.out.format 完全相同,或者它们在某种程度上有所不同?

解决方案

System.out 是一个 PrintStream ,然后引用javadoc作为 PrintStream.printf


这个
形式的方法调用 out.printf(l,format,args)
的行为与调用
out.format(l,format,args)的行为完全相同。



Are System.out.printf and System.out.format totally the same or perhaps they differ in somehow?

解决方案

System.out is a PrintStream, and quoting the javadoc for PrintStream.printf

An invocation of this method of the form out.printf(l, format, args) behaves in exactly the same way as the invocation out.format(l, format, args)

这篇关于System.out.printf与System.out.format的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆