import java.rmi.*;
import java.rmi.*;
import java.rmi.server.*;
import java.lang.Math.*;
import java.rmi.*;
import java.rmi.*;
int n1 = Integer.parseInt(ar[1]);
int n2 = Integer.parseInt(ar[2]);
Output:
D:\Server>javac *.java
D:\Server>rmic Server
D:\Server>start rmiregistry
D:\Server>java TestServer
D:\Client>javac Client.java
Class Diagram:
Class Description:
The program above is basically used for demonstrating the RMI concept which helps in
remote method invocation of the server methods from the client through the use of server
stub. The program consists of 3 classes and 1 interface. Firstly, we have the interface
ServerInterface which extends an existing interface Remote so as to provide the remote
methods. Then, we have the Sever class that extends from UnicastRemoteObject which
helps in the creation of the stub which is used in the client side so as to enable remote
method invocation. And Server class implements SeverInterface, thus implementing all the
methods defined in SeverInterface. Class TestServer is basically used to test the server that
we have creating by creating an object of Sever class and then rebind it. Finally, we have
the class Client which creates an object of ServerInterface and using this objects and the
server stub gets access to all the methods thus demonstrating Remote Method Invocation.
Interface Used:
Class Used:
Methods Used: