public interface Person(){
public void sayHello();
}
Public class PersonImplA implements Person{
public PersonImplA(){}
public void sayHello(){ System.out.println(“Hello!”); }
}
Public class PersonImplB implements Person{
public PersonImplB(){}
public void sayHello(){ System.out.println(“Nice to meet you!”); }
}
客户端:Person p = Naming.lookup(“PersonService”);
p.sayHello();
|
|