O'Reilly logo

Java™ Phrasebook by Timothy Fisher

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

7. Numbers

Working with numbers in Java is a subject that every programmer should become proficient in, as nearly every program deals with numbers of one form or another. In this chapter, we primarily use the basic numeric Java types, their object wrappers, and the java.lang.Math class.

Table 7.1 summarizes the built-in types that Java offers and lists their wrapper objects available. Note that the boolean type does not have a bit size because it can contain only two discrete values, a value of true or false.

Table 7.1. Java’s Built-In Types
TypeSize in bitsWrapper Object
byte8Byte
short16Short
int32Integer
long64Long
float32Float
double64Double
char16Character
boolean--Boolean

The object wrapper classes are useful when you want to treat a basic type ...

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