⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug6_2.java

📁 程序练习中包括书中实例程序代码和练习中要用到的代码,是压缩文件
💻 JAVA
字号:
package questions.c6;
interface IfaceDebug6_2 {
   public void f( int input );
}
class D62_OutOfRangeException extends Exception {
}
public class Debug6_2 implements IfaceDebug6_2 {
   public static final int MAX_X = 1000;
   public static final int MIN_X = 10;
   private int x;
   public void f( int input ) {
      setX( input );
   }
   public int getX() {
      return x;
   }
   public void setX( int value ) {
      if ( value >= MIN_X && value <= MAX_X ) {
         x = value;
      } else {
         throw new D62_OutOfRangeException();
      }
   }
   public static void main( String[] args ) {
      Debug6_2 a = new Debug6_2();
      a.f( 275 );
      System.out.println( a.getX() );
   }
}

⌨️ 快捷键说明

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