created 07/10/2006, revised 04/17/2010, 08/23/2016
This chapter discusses how to control the appearance of a number when it is converted into characters for output. For example, instead of
value = 13.333333333333334
you can ask for only two places right of the decimal point:
value = 13.34
This chapter is optional. Future chapters do not depend on it, so you can safely skip it. However, your programs will produce better looking output if you use number formatting.
There is much more to formatting numbers than this chapter discusses. Sometime in the future you may wish to study the detailed Java documentation from Oracle.
Depending on location and language, different formats are used for numbers, dates, times, and money. Customizing a program for location and language is called internationalization. This chapter only briefly discusses this.
How would you prefer to see this number displayed:
123456789