city2impl.java

来自「《JAVA分布式程序设计》一书的源代码。」· Java 代码 · 共 36 行

JAVA
36
字号
import java.rmi.*;import java.rmi.server.UnicastRemoteObject;/** * @(#)City2Impl.java * @author Qusay H. Mahmoud */public class City2Impl extends UnicastRemoteObject implements City2 {   private String cityName;    public City2Impl() throws RemoteException {     super();   }      public City2Impl(String cityName) throws RemoteException {      super();      this.cityName = cityName;   }   public int getPopulation() throws RemoteException {      if (cityName.equals("Toronto")) {         return 10;      } else if (cityName.equals("Ottawa")) { 	 return 2;      } else { 	 return 0;      }   }     public int getTemperature() throws RemoteException {      return 1;   }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?