O'Reilly logo

Java 7: A Beginner's Tutorial (Third Edition) by Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required