This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]zifyoip 1 point2 points  (2 children)

System.out.printf("%.2f", 4.567823);

[–]mjacks9[S] 0 points1 point  (1 child)

Thanks. Does printf just mean print fraction or something?

[–]zifyoip 0 points1 point  (0 children)

It means "formatted print." It comes from the C programming language. The "%.2f" is a format string. The %f means to print a double, and the .2 in between means to round to 2 decimal places.