Chapter 3

Working with Numbers and Expressions


check Dealing with operators, such as +, –, *, and /

check Creating finely crafted expressions

check Incrementing and decrementing

check Accepting an assignment

check Using the Math class

check Formatting your numbers

check Seeing strange things that can happen with numbers

In Book 2, Chapter 2, you discover the various primitive numeric types that are supported by Java. In this chapter, you build on that knowledge by doing basic operations with numbers. Much of this chapter focuses on the complex topic of expressions, which combine numbers with operators to perform calculations. This chapter also covers performing advanced calculations using the Math class and techniques for formatting numbers when you display them. In addition, you find out why Java’s math operations ...

Get Java All-in-One For Dummies, 5th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.