class PrintfEx2 { public static void main(String [] args){ int year = 2007; double rate = 6.716; System.out.println("123456789012345"); System.out.printf("%5d%n", year); System.out.printf("%5.2f %n", rate); System.out.printf("%5d%6.2f %n", year, rate); System.out.printf("%5d %6.2f %n", year, rate); } } /* * format specifier %d outputs a decimal integer. * %5d reserve 5 columns for the integer, right justified. */