carexception.java

来自「java2 primer plus一书源程序」· Java 代码 · 共 40 行

JAVA
40
字号
public class CarException extends Exception
{
  private boolean engineRunning = true;
  private boolean gas = true;
  private boolean oil = true;

  public CarException()
  {
    super();
  }

  public CarException( String message )
  {
    super( message );
  }

  public void setEngineRunning( boolean engineRunning ) {
    this.engineRunning = engineRunning;
  }

  public boolean isEngineRunning() {
    return this.engineRunning;
  }

  public void setGas( boolean gas ) {
    this.gas = gas;
  }

  public boolean hasGas() {
    return this.gas;
  }

  public void setOil( boolean oil ) {
    this.oil = oil;
  }

  public boolean hasOil() {
    return this.oil;
  }
}

⌨️ 快捷键说明

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