import java.rmi.*; import java.rmi.server.*; import java.rmi.registry.*; import java.io.*; public class RMIServer2{ public static void main(String argumendid[]) throws Exception{ Koolilaps juku=new Koolilaps(); Arvutaja kooliesindaja=(Arvutaja)UnicastRemoteObject.exportObject(juku); Registry register=LocateRegistry.getRegistry("localhost", 1099); register.rebind("arvutamine", kooliesindaja); System.out.println("Server korras"); new BufferedReader(new InputStreamReader(System.in)).readLine(); //oodatakse reavahetust register.unbind("arvutamine"); UnicastRemoteObject.unexportObject(juku, true); } }