package InherienceTest
public class BaseClass
{
public BaseClass(){
System
}
protected static void FuncTest(){
System
}
public static void main(String[] args){
FuncTest();
System
System
}
};
import InherienceTest
public class InherienceTest extends BaseClass//注意
{ //基類不能和派生類在同一目錄下面
public static void main(String[] args) //main函數必須是pulic static
{
InherienceTest xx=new InherienceTest();//構造函數被執行
xx
System
}
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26621.html