Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Mastering Java: The Ultimate Quiz for 'Thinking in Java'. Dive deep into Java with multiple-choice questions. Challenge yourself with quiz questions designed to test and improve your understanding of the 'Thinking in Java' book. Get ready for your exam!

Practice this question and more.


In Java, which operator can change the value of its operand through 'side effects'?

  1. Comparison operator

  2. Logical operator

  3. Assignment operator

  4. Additive operator

The correct answer is: Assignment operator

The assignment operator (=) is the only operator that can change the value of its operand through side effects. Comparison operators (==, !=, >, <, >=, <=) only compare values and do not alter them. Logical operators (&&, ||, !) only perform logical operations and do not change the values of its operands. Additive operators (+, -) only perform mathematical operations and do not change any values. The assignment operator is unique in that it can both assign a value to its operand and modify its original value.