Chapter 3

Working with Numbers and Expressions

IN THIS CHAPTER

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