Java uses literals and operators in a style that will be very familiar to all C programmers. In this chapter, we review the way Java uses literals to initialize primitive variables, create objects, and pass values to methods. We then review all of the Java operators used in expressions with both primitives and objects. You should not assume that the behavior of operators is the same in Java as in C. Pay particular attention to the difference between the == operator (double equals sign) and the equals method; this seems to confuse many programmers.

Get Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) now with O’Reilly online learning.

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