Messages are the communication mechanism between objects.


Messages enable one object to invoke an action (method) in another object.


Messages comprise of three components:

  1. The object being addressed
  2. The method to perform
  3. Any parameters required by the method

Carry on with the previous example, the messages can be seen on line 32:


objectA.set("Hello, ", "World!") ;


and similarly on line 34 (without parameters):

Compile & Run:

Hello, World!

Leave a Reply