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

command line,那個電影世界裡駭客電腦上的黑色小視窗

command line,那個電影世界裡駭客電腦上的黑色小視窗

D3v4 工作坊 - WebVR 與資料視覺化

D3v4 工作坊 - WebVR 與資料視覺化

r3:0 異世界網站挑戰 Lv. 11 ~ 15 攻略

r3:0 異世界網站挑戰 Lv. 11 ~ 15 攻略


Comments