Which statement prints the floating-point value 123.456 right justified with a field width of 10? Question 13 options: A) System.out.printf("%f10.3", 123.456); B) System.out.printf("%10.3f", 123.456); C) System.out.printf("%d10.3", 123.456); D) System.out.printf("%10.3d", 123.456);

Respuesta :

Answer:

B) System.out.printf("%10.3f", 123.456);

Explanation:

The statement

System.out.printf("%10.3f", 123.456)

Can be divided in to two

1. %10.3f

2. 123.456

The first represents the print format.

It is used to print floating point values

The 10 represents the field width

The 3 represents numbers of decimals

And

It'll be justified, right because there's no minus (-) in between the % and the number to be printed.

The second part, 123.456 represents the value to be printed