Java经典例程 从外国一大学计算机教授出版物下载的代码 经典

源代码在线查看: magicnumber.java

软件大小: 542 K
上传用户: focuslocus
关键词: Java 大学 代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				import java.rmi.*;
				import java.rmi.server.*;
				
				/*  A remote object      by J M Bishop  Oct 1997
				 *  ===============      Java 1.2 August 2000
				 *
				 *  These objects can be registered on one machine and
				 *  accessed via the Internet and rmi protocol from other
				 *  machines.  Compilation is a two-step process:
				 *    javac MagicNumber.java
				 *    rmic MagicNumber
				 *  The latter creates skeletons and stubs for the
				 *  remote object. To make it accessible on the network:
				 *  In Window 1 type:
				 *    rmiregistry
				 *  The registry will stay running.
				 *  Then activate the server and client parts of the system.
				 */
				
				class MagicNumber extends UnicastRemoteObject implements Transferable {
				
				  MagicNumber () throws RemoteException {
				  }
				
				  public String getNumber () throws RemoteException {
				    return "Your magic number is "+ (int) (Math.random()*100);;
				  }
				
				}
				
							

相关资源