What Is an Expression?

Expressions—combinations of operators and operands—are one of the key building blocks of the Java language, as they are of most any programming language. Expressions allow you to perform arithmetic calculations, compare values, perform logical operations, and manipulate objects. Without expressions, a programming language would be of little use to you.

You've already seen some expressions, mostly fairly simple ones, in other chapters in this book. Chapter 3, "Data Types and Other Tokens," showed you that the operators used in expressions form one of the main classifications of Java tokens, along with others such as keywords, comments, and so on. In this chapter, you get a closer look at how you can use operators to build ...

Get Special Edition Using Java 2 Standard 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.