Numbers and Dates
In Java numbers are represented by the primitives byte, short, int, long, float, double, and their wrapper classes, which were explained in Chapter 5, “Core Classes.” Dates can be represented by different classes, most commonly by the java.util.Date class. There are three issues when working with numbers and dates: parsing, formatting, and manipulation.
Parsing deals with the conversion of a string into a number or a date. Parsing is commonplace because Java programs often require user input and user input is received as a String. If a program expects a number or a date but receives a String, then the String has to be converted into a number or a date. Conversion is not always straightforward. Before conversion can ...