smartworldimpl.java

来自「最新的关于精通rmi这本书的源码」· Java 代码 · 共 51 行

JAVA
51
字号
/*
 * Copyright 1999 by dreamBean Software,
 * All rights reserved.
 */
package smartworld.server;

import java.rmi.RemoteException;
import java.rmi.server.RemoteServer;
import java.rmi.server.UnicastRemoteObject;

import smartworld.interfaces.SmartWorld;

/**
 *   This class implements the HelloWorld interface, and makes it possible to use 
 *   as a remote object by explicitly exporting it on creation.
 *      
 *   @see HelloWorld
 *   @author Rickard 謆erg (rickard@dreambean.com)
 */
public class SmartWorldImpl
   extends RemoteServer
   implements SmartWorld
{
   // Constructors --------------------------------------------------
   
   // HelloWorld implementation -------------------------------------
   /**
    *   Create a greeting, including the name that is given
    *
    * @param   name  a name
    * @return     a greeting
    */
   public String helloWorld(String name)
   {
      return "Hello " + name +"!";
   }
   
   public void sayHi(String name, boolean nice)
   {
      System.out.println(name + (nice? " is nice" : " is not nice"));
   }
   
   public String[] testArrays(int[][] arr)
   {
      return new String[] 
      {
         "Hello", "World"
      };
   }
}

⌨️ 快捷键说明

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