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.
The next chapter discusses a simpler way to format output nicely. You may wish to jump to that chapter (or skip it as well.)
The material in this chapter (and the next) is not tested in AP Computer Science.
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: