Netty-15-计算的例子
2017年11月16日小于 1 分钟
本地调用
接口
package com.github.houbb.netty.calc.api;
/**
* 计算接口
* @author binbin.hou
* @date 2019/4/22
* @since 0.0.1
*/
public interface ICalc {
/**
* 将两个元素添加起来
* @param first 第一个元素
* @param second 第二个元素
* @return 累计的结果
*/
int add(int first, int second);
}
本地调用
package com.github.houbb.netty.calc.local;
import com.github.houbb.netty.calc.api.ICalc;
/**
* 本地实现
* @author binbin.hou
* @date 2019/4/22
* @since 0.0.1
*/
public class LocalCalc implements ICalc {
@Override
public int add(int first, int second) {
return first+second;
}
public static void main(String[] args) {
ICalc calc = new LocalCalc();
System.out.println(calc.add(10, 20));
}
}
参考资料
贡献者
binbin.hou