This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
when an exported object of type UnicastRemoteObject is passed as a parameter or return value in an RMI call, the object is replaced by the remote object's stub. An exported remote object implementation remains in the virtual machine in which it was created and does not move (even by value) from that virtual machine. In other words, an exported remote object is passed by reference in an RMI call
The rules governing how arguments and return values are passed are as follows.
Remote objects are essentially passed by reference. A remote object reference is a stub, which is a client-side proxy that implements the complete set of remote interfaces that the remote object implements.
Local objects are passed by copy, using object serialization. By default all fields are copied, except those that are marked static or transient. Default serialization behavior can be overridden on a class-by-class basis.
That last explanation is probably the simplest, and explains the problem you are seeing.
Just stating that class A implements Remote does not mean that it will be passed as an exported Remote object - since you have not exported it (as indicated by Oricio) Java will revert to sending a copy of the local A instance.
So lets convert your code to export A, which means that it will pass a remote object reference:Now when we test this, we can see that we get the same value on both client and server: