📄 calculatorproxy.java
字号:
/*
* 创建日期 2005-4-20
*
* 更改所生成文件模板为
* 窗口 > 首选项 > Java > 代码生成 > 代码和注释
*/
package BUAA.NLSDE;
/**
* @author friends
*
* 更改所生成类型注释的模板为
* 窗口 > 首选项 > Java > 代码生成 > 代码和注释
*/
import java.io.Serializable;
import java.rmi.RemoteException;
import net.jini.core.lookup.ServiceID;
import net.jini.lookup.ServiceIDListener;
/**
* 计算器服务代理
*/
public class CalculatorProxy
implements Calculator, ServiceIDListener, Serializable {
public CalculatorProxy() throws RemoteException {
super();
}
// 获得服务标识符
public void serviceIDNotify(ServiceID id) {
System.out.println("Service ID is: " + id);
}
// 加法操作
public double add(double firstOperand, double secondOperand)
throws RemoteException {
return firstOperand + secondOperand;
}
// 减法操作
public double subtract(double firstOperand, double secondOperand)
throws RemoteException {
return firstOperand - secondOperand;
}
// 乘法操作
public double multiply(double firstOperand, double secondOperand)
throws RemoteException {
return firstOperand * secondOperand;
}
// 除法操作
public double divide(double firstOperand, double secondOperand)
throws RemoteException {
return firstOperand / secondOperand;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -