class StringFormat { public static void main(String[] args) { int a=3, b=4; System.out.printf("%d + %d = %d\n", a, b, a+b); System.out.printf("%10.2f\n", 3.0/7); System.out.printf("%08d\n", 124); String s = String.format("%d + %d = %d", a, b, a+b); System.out.println(s); for(int i=0; i<=10; i++) { System.out.printf( "%2d %6.0f\n", i, Math.pow(2, i) ); } } }