public class PrintfVsPrintlnDemo { public static void main(String args[ ]) { String u = "Pizza contains the 4 major food groups."; char w ='1'; //character 1 not numerical value 1 int x = 3; float y = 32.7F; double z = 123456789.987654321; System.out.printf("I love pizza!\n"); System.out.println("I love pizza!"); System.out.printf("Another reason to eat pizza: %s \n", u); System.out.println("Another reason to eat pizza: " + u); System.out.printf("Value in w is: %c \n", w); System.out.println("Value in w is: " + w); System.out.printf("value in x is: %d, value in y is: %.2f, value in z is: %,.8f \n", x, y, z); System.out.println("value in x is: " + x + ", value in y is: " + y + ", value in z is: " + z); System.out.printf("%10d\n",x); System.out.printf("%10.0f\n",y); System.out.printf("%10.0f\n",z); } //closing main method } //closing class header /* output I love pizza! I love pizza! Another reason to eat pizza: Pizza contains the 4 major food groups. Another reason to eat pizza: Pizza contains the 4 major food groups. Value in w is: 1 Value in w is: 1 value in x is: 3, value in y is: 32.70, value in z is: 123,456,789.98765433 value in x is: 3, value in y is: 32.7, value in z is: 1.2345678998765433E8 3 33 123456790 */