public?class?Main?{
????public?static?void?main(String[]?args)?{
????????test?test?=?new?test();
????????test.xxx(new?zi());
????}
}
class?fu{
????public?void?x(){
????????System.out.println("我是父");
????}
}
class?zi?extends?fu{
????public?void?x(){
????????System.out.println("我重寫了父類的x方法");
????}
????public?void?xx(){
????????System.out.println("我是子");
????}
}
class?test{
????public?void?xxx(fu?xxx){
????????xxx.x();
????}
}
每天學多一點點 哪怕一點點 我都是進步.........?
?
成功以基礎首 誰不是那樣過來的呢...
作者:??咸瑜???
本文摘自 :https://blog.51cto.com/u