?? chess.java
字號:
// reusing/Chess.java
// TIJ3 Chapter Reusing, Exercise 6, page 246
/* Using Chess.java, prove the statements in the previous paragraph. (If you
* don't call the base class constructor in BoardGame(), the compiler will
* complain that it can't find a constructor of the form Game(). In addition, the
* call to the base-class constructor must be the first thin you do in the
* derived-class constructor. The compiler will remind you if you get it wrong.)
*/
import static net.mindview.util.Print.*;
class Game {
Game(int i) {
print("Game constructor");
}
}
class BoardGame extends Game {
BoardGame(int i) {
// print("BoardGame constructor"); // call to super must be first
// statement in constructor
super(i); // else: "cannot find symbol: constructor Game()
print("BoardGame constructor");
}
}
public class Chess extends BoardGame {
Chess() {
super(11);
print("Chess constructor");
}
public static void main(String[] args) {
Chess x = new Chess();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -