Printf在1.5版本中添加到Java中,但是我似乎找不到如何将输出发送到字符串而不是文件的方法(这是sprintf在C语言中的作用)。有谁知道如何做到这一点?
// Store the formatted string in 'result' String result = String.format("%4d", i * j); // Write the result to standard output System.out.println( result );
查看格式及其语法
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
点击生成二维码
我来说两句