Multiple choice technology programming languages

How do objects pass messages in Java?

  1. They pass messages by modifying each other's fields

  2. They pass messages by calling each other's instance methods

  3. They pass messages by modifying the static variables of each other's classes

  4. They pass messages by calling static methods of each other's classes

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In object-oriented programming, objects interact and communicate by invoking (calling) each other's instance methods. Modifying fields directly violates encapsulation, and static methods belong to classes rather than individual object instances.