雖然到現在為止也沒有幾題,不過我也是邊寫邊學
如果有發現錯誤的地方,還請留言告知喔 ^^\\
不過我會努力不出現錯誤的
第三十一題: |
Given: public
class Base { |
What is the result? A. foofoofoofoofoo |
答案:D |
執行結果:無 |
題目範圍:物件觀念、變數的標記 |
解析: 標記為final的屬性雖然不可以修改數值,但是繼承時依然可以被複寫 到現在為止,前面的例題中偶爾會出現foo跟bar來命名的變數或方法 |
第三十二題: |
Given: class Mammal { |
Which four statments are true? (Choose four.) A. Raccoon is-a Mammal. |
答案:ABCF |
執行結果:無 |
題目範圍:物件觀念 |
解析: 英文解釋:Raccoon 狸,Mammal 哺乳動物 雖然照理來說BabyRaccoon應該屬於(is-a)Raccoon Raccoon has-a Mammal.雖然看起來很怪,但是程式中就是這樣寫的 |
第三十三題: |
Given: 2. public
class Hi{ |
Which four code fragments, inserted independently at line 7, will compile? (Choose four.) A. public void m1(){} |
答案:ABEF |
執行結果:答案中 |
題目範圍:物件觀念 |
解析: 請參閱: |
第三十四題: |
Which four statements are true? (Choose four.) A. Has-a relationships should never be encapsulated. B. Has-a relationships should be implemented using inheritance. C. Has-a relationships can be implemented using instance variables. D. Is-a relationships can be implemented using the extends keyword. E. Is-a relationships can be implemented using the implements keyword. F. The relationship between Movie and Actress is an example of an is-a relationship. G. An array or a collection can be used to implement a one-to-many has-a relationship. |
答案:CDEG |
執行結果:無 |
題目範圍:物件觀念 |
解析: 英文解釋:encapsulated 封裝 注意這題的implemented 並不是關鍵字implements 的意思,單純是語意上的"實現"的意思 |
第三十五題: |
Given: public
class Hello { Hello c = new Hello(5); |
What is the result? A. Hello |
答案:C |
執行結果:答案中 |
題目範圍:物件觀念 |
解析: 特別注意這題的Hello()方法是一個建構子,建構子是不能直接呼叫的 建構子可以有public private proceted 標籤 例如: |
留言列表