BankAccount
Home ] Up ] [ BankAccount ] BankAccountImpl ] BankAccountServer ] BankAccountClient ] Running the Example ]

 

 

Here's the BankAccount remote interface:

package rmi;

import java.rmi.Remote;
import java.rmi.RemoteException;

/**
 * A simple RMI remote interface to a bank account.
 * @author Bryan Higgs
 */
public interface BankAccount extends Remote
{
  /**
   * Returns the unique account id
   * @return the unique account id
   */
  public int getAccountId() throws RemoteException;
  
  /**
   * Returns the name of the bank account holder.
   * @return the name of the holder of this bank account
   */
  String getHolder() throws RemoteException;
  
  /**
   * Deposit an amount
   * @param amount the amount to deposit
   * @return the balance after the deposit completed.
   */
  double deposit(double amount) throws RemoteException;
  
  /**
   * Withdraw an amount
   * @param amount the amount to withdraw
   * @return the balance after the withdrawal completed.
   */
  double withdraw(double amount) throws RemoteException;
  
  /**
   * Gets the current balance
   * @return the current balance in the account
   */
  double getBalance() throws RemoteException;
}

It shows several methods, and also shows passing parameters to those methods, and the methods returning values.

 
The page was last updated February 19, 2008