隨筆-14  評論-142  文章-0  trackbacks-0

          下面這段代碼是有關(guān)java繼承關(guān)系的一道難題,你知道輸出結(jié)果是什么嗎?

          public ? class ?Target? extends ?Depend? {
          ????
          ?????
          int ?i? = ? 30
          ;

          ????
          public ?Target()
          {
          ????????print();
          ????????i?
          = ? 40
          ;
          ????????
          ?????}

          ????
          void ?print() {
          ????????????
          ????????????System.out.println(
          " Target=>? " ? +
          ?i);
          ?????
          ???????}

          ????
          ????
          public ? static ? void ?main(String[]?args)? {
          ????????
          ????????System.out.println(
          new
          ?Target().i);

          ?????}


          }


          class ?Depend {
          ????
          ????
          int ?i? = ? 10
          ;
          ???
          public ?Depend()
          {
          ????????
          ????????print();
          ????????i?
          = ? 20
          ;
          ????}

          ???
          void ?print() {

          ????????System.out.println(
          " Depend=>? " ? +
          ?i);
          ????}

          ????
          }

          posted on 2006-05-28 15:30 liulang 閱讀(926) 評論(0)  編輯  收藏

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 鸡东县| 资源县| 南投市| 沾化县| 栾川县| 镇安县| 东至县| 聂拉木县| 德安县| 武陟县| 灵川县| 永清县| 望江县| 淮南市| 凌海市| 离岛区| 固原市| 林周县| 许昌市| 大名县| 河北区| 津市市| 柳河县| 岐山县| 当阳市| 隆尧县| 柘城县| 台湾省| 淳化县| 辉南县| 郓城县| 冕宁县| 沿河| 上栗县| 兰考县| 武城县| 阳朔县| 长寿区| 金阳县| 荔浦县| 金堂县|