public interface BankAccount extends java.rmi.Remote { public void deposit(float amount) throws java.rmi.RemoteException; public void withdraw(float amount) throws OverdrawnException, java.rmi.RemoteException; public float getBalance() throws java.rmi.RemoteException; }
下例说明了有效的远程接口 Beta。它扩展非远程接口 Alpha(有远程方法)和接口 java.rmi.Remote: public interface Alpha { public final String okay = "constants are okay too"; public Object foo(Object obj) throws java.rmi.RemoteException; public void bar() throws java.io.IOException; public int baz() throws java.lang.Exception; }
public interface Beta extends Alpha, java.rmi.Remote { public void ping() throws java.rmi.RemoteException; }