?? wolf.java
字號:
/**
* Description:
* <br/>Copyright (C), 2005-2008, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
class Creature
{
public Creature()
{
System.out.println("Creature無參數的構造器");
}
}
class Animal extends Creature
{
public Animal(String name)
{
System.out.println("Animal帶一個參數的構造器,該動物的name為" + name);
}
public Animal(String name , int age)
{
//使用this調用同一個重載的構造器
this(name);
System.out.println("Animal帶2個參數的構造器,其age為" + age);
}
}
public class Wolf extends Animal
{
public Wolf()
{
//顯式調用父類有2個參數的構造器
super("土狼", 3);
System.out.println("Wolf無參數的構造器");
}
public static void main(String[] args)
{
new Wolf();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -