SCJP 試題文法有問題可以送分嗎?

Rate this post

昨天在看SCJP 6.0認證教戰手冊 (附光碟)

時第39題:

Given:

public class ItemTest {

private final int id;
public ItemTest( int id ) { this.id = id; }
public void updateId( int newId ) { id = newId; }
public static void main(String[] args) {
ItemTest fa = new ItemTest(42);
fa.updateId(69);
System.out.println(fa.id);
}

}

Which four statements are true?(choose four)

A. Compilation fails (編譯失敗)
B. An exception is thrown at runtime (執行時期丟出 exception)
C. The attribute id in the Item object remains unchanged (Item 物件中的屬性 id 保留無法改變)
D. The attribute id in the Item object is modified to the new value (Item 物件中的屬性 id 被修改成新值)
E. A new Item object is created with the preferred value in the id attribute (一個新的 Item 物件中的屬性 id 被設成指定值)
答案:A

明明就只有一個答案,為什麼要選四個?我剛開始還一直絞盡腦汁說這要怎麼選這麼詭異的題目!

後來看到

問題是這樣問:What is the result? (結果如何)

這樣才讓人看得懂,這個問題很有可能是書本的錯誤,但如果是考試出錯了的話會送分嗎?

本站部分內容包含聯盟行銷連結。當您透過連結購買商品或服務時,本站將獲得微薄的佣金,這並不會影響您的購買價格,但能支持本站的運作,感謝您的支持。問題詢問

點我分享到Facebook

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *