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

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

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What type of variables does the assignment with primitives in Java affect?

  1. Object references

  2. Primitive values directly

  3. The class variables

  4. Java does not allow assignment with primitives

The correct answer is: Primitive values directly

When assigning a primitive value in Java, the assignment affects the primitive value directly. This means that any changes made to the assigned variable will directly affect the assigned value and not any other references or class variables. This is different from assigning object references, which affect the reference to an object rather than the actual object itself. Java does allow assignment with primitives, contrary to option D, which is why option B is the correct answer.