格式化布尔,字符,字符串,整数,长整型和双精度型的数据类型
//来自 时 代 J a v a - nowjava.com import java.io.*; public class PrintfStuff { public static void main(String[] args) throws IOException { char three[] = { 't', 'h', 'r', 'e', 'e' }; System.out.printf("%b %n %c %n %s %n %s %n %d %n" + "%d %n %g %n %g %n %s %n", !false, '3', new String(three), "Three", 3, Long.MAX_VALUE, Math.PI, Double.MAX_VALUE, new Object()); } }