You can invoke the methods of objects on other machines, hence the name remote method invocation . The code on a client calls a method on a server. Actually, it calls a regular Java method that is encapsulated in a stub class. Objects that are referenced are serialized with the default Java object serialization which flattens a local Java object's state into a serial stream that it can then pass as a parameter inside a message. On the other hand, you can invoke methods over the network, so it passes the object by reference, not by copying the actual object over the network.
All remote objects have be serializable.
The default mechanism writes all fields except transient and static , to the ObjectOutputStream . The parameters in the remote method are packaged as byte streams. The process of encoding the parameters for transport is called marshalling. An operation number specifying the method called. The marshalled parameters On the server side, the skeleton object interprets the information from the stub, and passes it to the object that executes the remote method.