It's not a secret anymore!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Object Communication Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Object Communication" Watch "Object Communication" New topic
Author

Object Communication

tinks
Greenhorn

Joined: Feb 23, 2002
Posts: 27
when objects communicate by passing messages , the message is sent my a method call.

class Message
{

static void call(int i)
{
System.out.println(i);
}

public static void main(String args[])
{
call(10);
}
}

how does parameter in the method call, provide exchange of information between the
caller object and callee object. which is the caller object and callee object.
there is no object instantiation what aobjects are this. Is method invoked on the object or the object is invoked on the method.please help, thanks.
eskay kumar
Ranch Hand

Joined: Jul 22, 2000
Posts: 71
Hi Prashant,
In this eg, since u r communicating between static methods, u wouldn't need an object (i.e. an instance of a class) to do the job. Static methods/variables are class level - meaning a single copy of these variables exists for the class rather than for every instance of the class.
The parameter's major role beside carrying the requisite information to the method, is also to help in choosing the appropriate method in case of method overloading.
An object invokes a method - not the other way around. A method is called by an object. There is nothing like a caller object and a callee object in your eg, - since ur calling a static method(call) from another static method(main) within the same class, u can call the method directly.
eskay !
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Object Communication
 
Similar Threads
How do I get the Method and Class caller?
questions about method overriding
monitoring RMI calls (by sniffing)
identifying the super object which invoked a method which was overridden
Who called?