close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決 
The Best Way to Manage your Money.

Start using Mint today to set a budget, track your goals and do more with your money.
From our sponsors
java 抽象類別問題
Dec 28th 2013, 06:53

正確答案為 b.

a.
抽象類別並未強制必須擁有抽象方法

編譯時這裡不會造成 error

抽象類別的非抽象方法,猶如替這個方法程序寫個默認版本

若子類別有 override 則參考子類別實作

反之則使用抽象類別本身的方法程序內容

b.
抽象類別無法用來建立新物件 (new Base)

其必須透過被繼承,使用子類別建立新物件才有實例

本題內改為 new Sub() 即可通過編譯

c.
並未硬性規定繼承者必須箝置 abstract, 故無錯誤

要求子類別也為抽象類別時才需箝置 abstract

d.
並未規定所有方法程序須箝制 final, 故無錯誤

final 效果為阻止方法程序的 override

也就是子類別禁止擁有相同名稱且同參數的方法程序

e.
編譯錯誤故不印出任何值

希望以上回答對您有幫助!

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 jmuko90 的頭像
    jmuko90

    2016【韓劇】奶酪陷阱劇情簡介及人物介紹奶酪陷阱 EP03 預告奶酪陷阱 線上看奶酪陷阱(捕鼠器裡的奶酪) 第1集

    jmuko90 發表在 痞客邦 留言(0) 人氣()