insufficientfundexception.java

来自「此源码为机械工业出版社出版的《Java语言程序设计》第三版所配套的书中所有源代码」· Java 代码 · 共 23 行

JAVA
23
字号
// InsufficientFundException.java: An exception class for describing
// insufficient fund exception
public class InsufficientFundException extends Exception
{
  // Information to be passed to the handlers
  private Account account;
  private double amount;
 
  // Construct an insufficient exception
  public InsufficientFundException(Account account, double amount)
  {
    super("Insufficient amount");
    this.account = account;
    this.amount = amount;
  }

  // Override the "toString" method
  public String toString()
  {
    return "Account balance is " + account.getBalance();
  }
}

⌨️ 快捷键说明

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