exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 92 discussion

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

Given:

What is the result?

  • A. IT:null
  • B. A NullPointerException is thrown at run time.
  • C. A compilation error occurs.
  • D. IT:0.0
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
pul26
Highly Voted 3 years, 6 months ago
Answer is B
upvoted 5 times
...
asdfjhfgjuaDCV
Most Recent 3 months ago
B is the answer
upvoted 1 times
...
steefaand
4 months, 1 week ago
Selected Answer: B
Answer is B, tested, NPE happens since Supplier provides null.
upvoted 1 times
...
WilsonKKerll
2 years, 3 months ago
Selected Answer: B
NullPointerExcepiton
upvoted 4 times
...
Tarik2190
3 years ago
Answer is B, class Job { String name; Integer cost; Job(String name, Integer cost) { this.name = name; this.cost = cost; } public String getName() { return name; } public int getCost() { return cost; } } public class Test { public static void main (String[] args) throws InterruptedException, ExecutionException { Job j1 = new Job("IT", null); DoubleSupplier dS = j1::getCost; System.out.println(j1.getName() + ": " + dS.getAsDouble()); } }
upvoted 1 times
...
Svetleto13
3 years, 1 month ago
B,tested.If we replace Integer(object) with int(primitive) answer is D.
upvoted 1 times
...
JME_CHG
3 years, 2 months ago
When I change int getCost() to Integer getCost() I thought DoubleSupplier line would fail compilation but it continued to work, anyone know why?
upvoted 1 times
hmcbq
3 years, 1 month ago
I think that int can't be null because it is primitive. But Integer is an object.
upvoted 2 times
...
Syyyyyyyy
1 week, 2 days ago
DoubleSupplier returns primitive double instead of Object Double, so since Integer can be cast to double, code will compile.
upvoted 1 times
...
...
Chiraj
3 years, 4 months ago
The answer is B tested.
upvoted 4 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