//CalculatorImpl.java
//Implementation
import java.rmi.server.UnicastRemoteObject
public class CalculatorImpl extends UnicastRemoteObject implements Calculator {
// 这个实现必须有一个显式的构造函数,并且要抛出一个RemoteException异常
public CalculatorImpl() throws java.rmi.RemoteException {
super();
}
public long add(long a, long b) throws java.rmi.RemoteException {
return a + b;
}
文章来源于领测软件测试网 https://www.ltesting.net/