what does it mean when
public interface Server extends Remote{
the above code is in place. I understand that the client will call the server but what does it mean for the server to extend remote.
what does it mean when
public interface Server extends Remote{
the above code is in place. I understand that the client will call the server but what does it mean for the server to extend remote.
For implementing a RMI one first need to create the remote interface and provide implementation to the remote interface.
For creating remote interface we need to extend remote interface.
import java.rmi.*;
public interface RemoteAdder extends Remote{
public int add(int x,int y)throws RemoteException;
}
Here RemoteAdder is my remote interface created by extending the remote interface.
for more explanation this link may help you:
Thanks!!
Any class implementing Server will have to provide code to the methods in both the Server and Remote interfaces. to illustrate, given:
public interface interfaceA {
String AMethod1();
String AMethod2();
}
and
public interface interfaceB extends interfaceA{
String BMethod();
}
If I implement interfaceB I will need to add implementations for both interfaceB and interfaceA methods
public class ImplementationClass implements interfaceB {
@Override
public String AMethod1() {
// TODO Auto-generated method stub
return null;
}
@Override
public String AMethod2() {
// TODO Auto-generated method stub
return null;
}
@Override
public String BMethod() {
// TODO Auto-generated method stub
return null;
}
}