illegalvalueexception.java

来自「程序练习中包括书中实例程序代码和练习中要用到的代码,是压缩文件」· Java 代码 · 共 34 行

JAVA
34
字号
package examples.exceptions;

/** A user-defined checked exception class to be
  * used when an illegal integer value is detected
  */
class IllegalValueException extends Exception {

   private int value;

   /** Class constructor
     * @param iv the illegal value that was
     *           detected
     */
   public IllegalValueException( int iv ) {
      value = iv;
   }

   /** Method to get the illegal value
     * @return the illegal value
     */
   public int getValue() {
      return value;
   }

   /** Method to set the illegal value
     * @param iv the illegal value
     * @return the updated IllegalValueException
     *         object
     */
   public IllegalValueException setValue( int iv ) {
      value = iv;
      return this;
   }
}

⌨️ 快捷键说明

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