java技術博客

          jsp博客
          數據加載中……
          ObjectTypeTest.java

           

          /**
          *通過這個程序,測試對象類型的多態實現
          */

          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 郭興華 閱讀(107) 評論(0)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 云和县| 汉阴县| 毕节市| 遵义县| 沅陵县| 巴彦县| 瓦房店市| 遂平县| 咸阳市| 南投县| 承德县| 张掖市| 黄骅市| 宕昌县| 衡山县| 建平县| 疏附县| 龙山县| 枝江市| 瑞安市| 沙湾县| 平潭县| 景东| 佛山市| 石景山区| 永寿县| 孟津县| 嘉义县| 吉水县| 旬阳县| 武强县| 嘉善县| 林州市| 揭西县| 砀山县| 连江县| 宁国市| 寿宁县| 九江县| 江山市| 饶阳县|