nerdexam
Oracle

1Z0-804 · Question #35

Given: What is the result?

The correct answer is A. p001 Widget. Compiles fine. Output is: P002 X-Large Widget Line: partList.put("P002", "X-Large Widget"); >> overwrites >> line:partList.put("P002", "Large V put(K key, V value) Associates the specified value with the specified key in this map (optional operation). If the map…

Java Class Design

Question

Given:

What is the result?

Exhibit

1Z0-804 question #35 exhibit

Options

  • Ap001 Widget
  • Bp002 Large Widget
  • Cp002 X-large Widget
  • Dp001 Widget
  • Ecompilation fails

How the community answered

(34 responses)
  • A
    79% (27)
  • B
    12% (4)
  • C
    6% (2)
  • E
    3% (1)

Explanation

Compiles fine. Output is: P002 X-Large Widget Line: partList.put("P002", "X-Large Widget"); >> overwrites >> line:partList.put("P002", "Large V put(K key, V value) Associates the specified value with the specified key in this map (optional operation). If the map previouslycontained a mapping for the key, the old value is replaced by the specified value. (Amap m is said to contain amapping for a key k if and only if m.containsKey(k) would key - key with which the specified value is to be associated value - value to be associated with the specified key Returnsthe previous value associated with key, or null if there was no mapping for key. (A null return can alsoindicate that the map previously associated null with key, if the implementation supports null values.)

Topics

#inheritance#field access#constructor#object state

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice