import java.rmi.Naming; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; public class ServerOperation extends UnicastRemoteObject implements RMIInterface{ protected ServerOperation() throws RemoteException {} public String halfMul(int number1, int number2) throws RemoteException{ if(number1/number2==2) return "Number1 is a multiple of number2" ; else if (number2/number1==2) return "Number2 is a multiple of number1" ; else return "They are not multiple" ; } public static void main(String[] args){ try { Naming.rebind("//localhost/MyServer", new ServerOperation()); System.out.println("Server ready"); } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } } }