productimpl.java
来自「core java第二卷源代码第三章。欢迎大家下载」· Java 代码 · 共 40 行
JAVA
40 行
/**
@version 1.00 1996-09-07
@author Cay Horstmann
*/
import java.io.*;
import java.rmi.*;
import java.rmi.activation.*;
/**
This is the implementation class for the remote product
objects.
*/
public class ProductImpl
extends Activatable
implements Product
{
/**
Constructs a product implementation
@param id the activation id
@param data the marshalled construction parameter (containing the
product name)
*/
public ProductImpl(ActivationID id, MarshalledObject data)
throws RemoteException, IOException, ClassNotFoundException
{
super(id, 0);
String n = (String)data.get();
name = n;
System.out.println("Constructed " + name);
}
public String getDescription() throws RemoteException
{
return "I am a " + name + ". Buy me!";
}
private String name;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?