exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 132 discussion

Actual exam question from Oracle's 1z0-819
Question #: 132
Topic #: 1
[All 1z0-819 Questions]

Which three initialization statements are valid? (Choose three.)

  • A. var loc = Arrays.of(“UK”, “US”, “ES”);
  • B. var loc = List.of(“UK”, “US”);
  • C. var loc = List.of(“UK”, null, “US”);
  • D. var loc = Map.of(“UK”, 1, “US”, 2);
  • E. var loc = ArrayList.of(“UK”, “US”);
  • F. var loc = Set.of(“UK”, “US”, “UK”);
  • G. var loc = Set.of(“UK”, “US”);
Show Suggested Answer Hide Answer
Suggested Answer: BDG 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ASPushkin
3 months, 2 weeks ago
Selected Answer: BDG
answer: BDG A. wrong there is no Arrays.of B. correct UnmodifiableList C. not correct C. is not correct List.of disallow null elements IN general unlike sets, lists typically allow duplicate elements. For example ArrayList D. correct static <K,​V> Map<K,​V> of​(K k1, V v1) from Java 11 E. wrong static <E> List<E> of​(E e1, E e2) F. wrong A collection that contains no duplicate elements G. correct static <E> Set<E> of​(E e1, E e2)
upvoted 1 times
ASPushkin
3 months, 2 weeks ago
E. wrong static <E> List<E> of​(E e1, E e2) default access method modifier so is not visible in the ArrayList
upvoted 1 times
...
...
d7bb0b2
1 year ago
Selected Answer: BDG
BDG is correct
upvoted 1 times
...
Omnisumem
1 year, 3 months ago
Selected Answer: BDG
Tested: BDG.
upvoted 2 times
...
Ashan_Ozlov
1 year, 3 months ago
Selected Answer: BDG
Not tested but a bit obvious
upvoted 1 times
...
[Removed]
1 year, 4 months ago
Selected Answer: BDG
BDG. C throws a NullPointerException and F throws a IllegalArgumentException
upvoted 1 times
...
Stavok
1 year, 5 months ago
Selected Answer: BDG
B. var loc = List.of("UK", "US"); D. var loc = Map.of("UK", 1, "US", 2); G. var loc = Set.of("UK", "US"); List.of, Map.of, and Set.of are all valid methods for creating unmodifiable collections of their respective types. The other options are invalid because: A. Arrays.of is not a valid method. C. List.of does not allow null elements. E. ArrayList.of is not a valid method. F. Set.of does not allow duplicate elements.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago