© Kishori Sharan 2017

Kishori Sharan, Beginning Java 9 Fundamentals, https://doi.org/10.1007/978-1-4842-2902-6_17

17. Formatting Data

Kishori Sharan

(1)Montgomery, Alabama, USA

In this chapter, you will learn:

  • How to format and parse dates and numbers

  • How to use the printf-style formatting

  • How to create a class that uses a custom formatter

Java provides a rich set of APIs for formatting data. The data may include simple values such as numbers or objects such as strings, dates, and other types of objects. This chapter covers formatting options in Java for different types of values. All example programs in this chapter are a member of a jdojo.format module , as declared in Listing 17-1.

Listing 17-1. The Declaration of a jdojo.format Module
// module-info.java ...

Get Beginning Java 9 Fundamentals: Arrays, Objects, Modules, JShell, and Regular Expressions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.