8. Numbers and Strings

Chapter Contents

Numbers

Characters

Strings

This chapter begins with a discussion of the Number class (in the java.lang package) and its subclasses. In particular, the first section talks about the situations where you would use instantiations of these classes rather than the primitive data types. Additionally, this section talks about other classes you might need to use while working with numbers, such as formatting or using mathematical functions to complement the operators built into the language. Finally, this section discusses autoboxing and unboxing, compiler features that can simplify your code.

The second section discusses characters, and the third section discusses strings. Strings are widely used in Java programming ...

Get The Java® Tutorial: A Short Course on the Basics, Fifth Edition 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.