calculator.java

来自「100多M的J2EE培训内容」· Java 代码 · 共 53 行

JAVA
53
字号
package bible.webservices.rpc;import java.rmi.*;import javax.ejb.*;/** * Class Calculator * A Session Bean that allows the user to perform simple arithmetic operations * on the two parameters provided.  The java primitives are passed to the Session * Bean via the SOAP Servlet.  The SOAP Servlet decodes the parameters from the * SOAP envelope which is sent from the user client.  The process is reversed when * the Session Bean sends its reply to the client. * * @author Geoff Schneider */public class Calculator implements SessionBean {  private SessionContext sessionContext;  public void ejbCreate() {  }  public void ejbRemove() throws RemoteException {  }  public void ejbActivate() throws RemoteException {  }  public void ejbPassivate() throws RemoteException {  }  public void setSessionContext(SessionContext sessionContext) throws RemoteException {    this.sessionContext = sessionContext;  }  /**   * Returns the sum of two long primitives.   */  public long add(long amount1, long amount2) {    return amount1 + amount2;  }  /**   * Returns the difference of two long primitives.   */  public long subtract(long amount1, long amount2) {    return amount1 - amount2;  }  /**   * Returns the product of two double primitives.   */  public double multiply(double amount, double factor) {    return amount * factor;  }  /**   * Returns the quotient of two double primitives.   */  public double divide(double amount, double divisor) {    return amount / divisor;  }}

⌨️ 快捷键说明

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