CHAPTER 4

Operators and Statements

In Chapter 3 we have seen the various data types used in the Java programming language. In this chapter, we discuss the various commonly used operators and statements available in the Java programming language.

4.1 OPERATORS

Most of the operators in Java work similar to C. In the following sections we discuss the operators available in Java. Assuming the knowledge of C, we do not discuss each and every operator in detail except for places where it is felt that the operators differ from C or they require an in-depth discussion. The operators in Java may be categorized as follows.

4.1.1 Arithmetic Operators

+ - * / and %

The above operators when used as binary operators can have operands of numeric types only, ...

Get The class of Java 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.