[單項(xiàng)選擇題] 閱讀下面代碼 class InterestTest ______ ActionListener { … public void act
2021-07-20
[單項(xiàng)選擇題] 閱讀下面代碼 class InterestTest ______ ActionListener { … public void actionPerformed(ActionEvent event) { double interest=balance * rate/100: balance+=interest: NumberFormat format=NumberFormat.getCurrencyInstance(); System.out.printlb("balance="+Formatter.format(balance)); } Private double rate; } 在下畫(huà)線(xiàn)處,應(yīng)填入的正確選項(xiàng)是
A.implementation
B.inheritance
C.implements
D.extends
正確答案:C
參考解析:關(guān)鍵字extends指明該類(lèi)是子類(lèi),它的父類(lèi)名緊跟在后,子類(lèi)與父類(lèi)之間有繼承關(guān)系。關(guān)鍵字implements指明該類(lèi)實(shí)現(xiàn)的接口,后跟接口名列表。因?yàn)锳ctionListener是時(shí)間監(jiān)聽(tīng)器,是接口,所以這里要填入implements,故答案為C。
詞條內(nèi)容僅供參考,如果您需要解決具體問(wèn)題
(尤其在法律、醫(yī)學(xué)等領(lǐng)域),建議您咨詢(xún)相關(guān)領(lǐng)域?qū)I(yè)人士。