class PrintfEx1 { public static void main(String [] args){ double x = 23.456, y = 211.56, z = 9993.3422; System.out.printf("x to 2 places %.2f %n", x); System.out.printf("y and z to 2 places %.2f %.2f%n",y,z); } } /* * %.2f is called a format specifier * this will output the value of x to two places * %n is the line separator */