arithimpl.java
来自「《JAVA分布式程序设计》一书的源代码。」· Java 代码 · 共 39 行
JAVA
39 行
import java.rmi.*;import java.rmi.server.UnicastRemoteObject;/** * @(#) Server.java * @author Qusay H. Mahmoud */public class ArithImpl extends UnicastRemoteObject implements Arith { private String name; public ArithImpl(String s) throws RemoteException { super(); name = s; } public int[] add(int a[], int b[]) throws RemoteException { int c[] = new int[10]; for (int i=0; i<10; i++) { c[i] = a[i] + b[i]; } return c; } public static void main(String argv[]) { System.setSecurityManager(new RMISecurityManager()); try { ArithImpl obj = new ArithImpl("ArithServer"); Naming.rebind("//localhost/ArithServer", obj); System.out.println("ArithServer bound in registry"); } catch (Exception e) { System.out.println("ArithImpl err: " + e.getMessage()); e.printStackTrace(); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?