java技術博客

          jsp博客
          數(shù)據(jù)加載中……
          ObjectTypeTest.java

           

          /**
          *通過這個程序,測試對象類型的多態(tài)實現(xiàn)
          */

          public class ObjectTypeTest{
          public static void main(String[] args){
          B a
          =new B();
          a.method2();
          }
          }

          class A{
          public void method1(){
          System.out.println(
          "this is class A method1");}
          }

          class B extends A{
          public void method1(){
          System.out.println(
          "this is class B method1");}

          public void method2(){
          System.out.println(
          "this is class B method2");}

          }

          posted on 2008-10-22 23:46 郭興華 閱讀(108) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 台州市| 霍州市| 塘沽区| 钟山县| 博罗县| 宁阳县| 根河市| 富民县| 德惠市| 张家港市| 三台县| 丘北县| 温宿县| 视频| 禄劝| 平遥县| 扎赉特旗| 闽清县| 通化县| 香河县| 通化市| 西充县| 巧家县| 雅江县| 武功县| 沈丘县| 介休市| 怀来县| 德阳市| 和顺县| 宣恩县| 丰宁| 三穗县| 辛集市| 阳信县| 西宁市| 寿阳县| 陈巴尔虎旗| 关岭| 阜城县| 翁牛特旗|