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?

