exam questions

Exam 1z0-819 All Questions

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

Exam 1z0-819 topic 1 question 15 discussion

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

Given the code fragment:
List<Integer> list = List.of(11,12,13,12,13);
Which statement causes a compile time error?

  • A. Double d = list.get(0);
  • B. double f = list.get(0);
  • C. Integer a = Integer.valueOf(list.get(0));
  • D. Integer b = list.get(0);
  • E. int c = list.get(0);
  • F. Double e = Double.valueOf(list.get(0));
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

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
4 months ago
Selected Answer: A
A. Double d = list.get(0); causes compile time error an unrelated type both types should be in the same inheritance tree - compiler exception
upvoted 1 times
...
d7bb0b2
1 year, 1 month ago
Only A not compile. Cannot convert Integer To Double directly, (Objetc integer to Object DOuble). ..But can asign Integer to double (primitive). For unboxing (Integer -> int) and then promotion of type int to double.
upvoted 4 times
...
Stavok
1 year, 7 months ago
Selected Answer: A
cannot convert from Integer to Double
upvoted 2 times
...
RoxyFoxy
1 year, 7 months ago
Selected Answer: A
Integer cannot be converted to Double
upvoted 1 times
...
RP384
1 year, 11 months ago
Selected Answer: A
cannot cast from Integer to Double, Double.valueOf() is needed
upvoted 3 times
...
supernho
1 year, 12 months ago
Selected Answer: A
A, cannot cast from Integer to Double
upvoted 1 times
...
Ankit1010
1 year, 12 months ago
A is correct Answer
upvoted 1 times
...
Leksh_geeth
2 years, 2 months ago
Answer is Option A
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