隨筆-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
          向上轉(zhuǎn)型吧。  回復(fù)  更多評論
            
          主站蜘蛛池模板: 汝阳县| 芮城县| 怀集县| 仲巴县| 台前县| 延吉市| 常熟市| 洞口县| 定陶县| 永新县| 嵊州市| 讷河市| 稷山县| 白银市| 虹口区| 金阳县| 嘉祥县| 尖扎县| 崇阳县| 元阳县| 呼伦贝尔市| 涿州市| 安远县| 黔南| 巴彦县| 澄城县| 吉安县| 梓潼县| 镇坪县| 通河县| 益阳市| 自贡市| 万州区| 梅州市| 沾化县| 嵊泗县| 灵石县| 金昌市| 周至县| 原阳县| 罗源县|