Linkedin Java 技術認證題庫


Posted by c9103205 on 2021-07-05

Which statements about abstract classes are true?

1. They can be instantiated.
2. They allow member variables and methods to be inherited by subclasses.
3. They can contain constructors.
  1. 1, 2, and 3
  2. only 3
  3. 2 and 3
  4. only 2

answer: 3
抽象類別的參數可以被子類別繼承,並可以包含建構子,但無法被實例化

Why are ArrayLists better than arrays?

  1. You don't have to decide the size of an ArrayList when you first make it.
  2. You can put more items into an ArrayList than into an array.
  3. ArrayLists can hold more kinds of objects than arrays.
  4. You don't have to decide the type of an ArrayList when you first make it.

answer : 1
出這題的人應該怨念很深,只要被array雷過的應該都有感覺,Java中的array必須宣告大小,這也是筆者認為array不好用的地方,一不小心就會 ArrayIndexOutOfBounds
其餘三點,array也能放入物件
ex:
Integer[] arraySimple = new Integer[10];


#linkedin #java







Related Posts

Colorful Glowing

Colorful Glowing

CSS保健室|用圖片來取代文字標題

CSS保健室|用圖片來取代文字標題

C 語言練習程式(1) & linux把檔案內容複製到剪貼簿

C 語言練習程式(1) & linux把檔案內容複製到剪貼簿


Comments