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 even(int number) throws RemoteException{ if(number%2==0) return "The number is even" ; else return "The number is odd" ; } 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(); } } }