Message passing is a kind of convey data or information between objects. A message is a kind of request for the execution of a function. To convey the message, we need three things object, the method in that object and the information. For example
class student{
private int marks;
public void store_marks(int marks){
this.marks = marks;
}
public int get marks(){
return marks;
}
}
Student st = new student();
st.store_marks(4);
st, object calls the method store marks and sends the data 4 as a message. this is called message passing. Methods of a object is called using . operator
Get Answers For Free
Most questions answered within 1 hours.