How can i send a MESSAGE from an object to another object?

i've following code:

class Receiver{

private String str ="Your message is recieved to me.";

String sendBack(){

return str;

}

}

class Sender{

publicstaticvoid main(String[] args){

Receiver r =new Receiver();

System.out.println(r.sendBack());

}

}

I'm confused with the concept of MESSAGE in java. All i gather about it is that when two objects want to communicate with each other they send messages to each other. One object is sender of message and other is its receiver.

Here reciever object 'r' itself performs its method and does not communicate with any other object. How do i change this code into where two objects communicate with each other?

[1257 byte] By [New-Drop@Java-Seaa] at [2007-11-26 14:27:12]
# 1
ffs! we've already answered this!the "message-passing" is going on behind the scenes, it's not something you can witness, or measure, and it's not something you need to be concerned with
georgemca at 2007-7-8 2:20:42 > top of Java-index,Java Essentials,New To Java...
# 2
>> How do i change this code into where two objects communicate with each other? You need to buy them both phone cards and add public PhoneNumber getPhoneNumber(){ return PhoneNumber; }so they can ring each other.
TuringPesta at 2007-7-8 2:20:42 > top of Java-index,Java Essentials,New To Java...
# 3

Well the OO theory says that objects comunicate via messages, now that information must be taken as knowledge only, not for programming issues really. What you need to know is that when you need to pass any data from onw object to another you can send them via parameters of defined methods.

For example you have an Object called R of a receiver class and that object needs to pass a String (text message) to another object. you can do it via a method.

MelGohana at 2007-7-8 2:20:42 > top of Java-index,Java Essentials,New To Java...
# 4
Good Day Friend!Message between two objects is done in the backgroundbut if you want to do it explicitly we have wait();notify();notifyAll();with regardsvasu_gb@yahoo.co.in
vasu_gba at 2007-7-8 2:20:42 > top of Java-index,Java Essentials,New To Java...