隨筆-109  評論-187  文章-25  trackbacks-0
          ?
          19: ? ? class A {
          public int getNumber(int a) {
          ? ? return a + 1;
          }
          ? ? ? ? }
          ?
          ? ? ? ? class B extends A {
          public int getNumber (int a) {
          return a + 2;
          ? ? ? ? }
          ?
          public static void main (String args[]) ?{
          A a = new B();
          14. System.out.printIn(a.getNumber(0));
          15. ? ?}
          16. } ?
          What is the result?
          A. Compilation succeeds and 1 is printed.
          B. Compilation succeeds and 2 is printed.
          C. An error at line 8 causes compilation to fail.
          D. An error at line 13 causes compilation to fail.
          E. An error at line 14 causes compilation to fail.
          Answer:B。記住一句話,成員變量(編譯時)看左邊,方法(運行時)看右邊。
          posted on 2006-04-13 08:57 小小程序程序員混口飯吃 閱讀(930) 評論(1)  編輯  收藏 所屬分類: java

          評論:
          # re: JAVA動態(tài)綁定 2007-07-03 14:46 | itkui
          向上轉型吧。  回復  更多評論
            
          主站蜘蛛池模板: 荆州市| 鄱阳县| 乌鲁木齐市| 巴里| 凤山县| 广东省| 太保市| 安达市| 甘孜县| 体育| 广平县| 基隆市| 富裕县| 云霄县| 肥城市| 闻喜县| 平罗县| 习水县| 滦南县| 陕西省| 西盟| 石渠县| 辛集市| 南溪县| 玉树县| 邹城市| 英吉沙县| 酉阳| 宾阳县| 容城县| 云霄县| 瑞金市| 九寨沟县| 镇宁| 丰城市| 和田县| 明星| 凤山市| 犍为县| 大埔县| 白玉县|