⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productimpl.java

📁 关于:Java2核心技术卷二 配套源码.
💻 JAVA
字号:
/**
 * @version 1.00 1996-09-07
 * @author Cay Horstmann
 */

import java.rmi.*;
import java.rmi.server.*;
import java.awt.*;

public class ProductImpl
   extends UnicastRemoteObject
   implements Product
{  public ProductImpl(String n, int s, int age1, int age2,
      String h, String i)
      throws RemoteException
   {  name = n;
      ageLow = age1;
      ageHigh = age2;
      sex = s;
      hobby = h;
      imageFile = i;
   }

   public boolean match(Customer c) // local method
   {  if (c.getAge() < ageLow || c.getAge() > ageHigh)
      return false;
      if (!c.hasHobby(hobby)) return false;
      if ((sex & c.getSex()) == 0) return false;
      return true;
   }

   public String getDescription() throws RemoteException
   {  return "I am a " + name + ". Buy me!";
   }

   public String getImageFile() throws RemoteException
   {  return imageFile;
   }

   private String name;
   private int ageLow;
   private int ageHigh;
   private int sex;
   private String hobby;
   private String imageFile;
}

⌨️ 快捷键说明

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