About Question enthuware.ocpjp.v8.2.1814 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Javier
Posts: 66
Joined: Mon Feb 20, 2017 12:31 pm
Contact:

About Question enthuware.ocpjp.v8.2.1814 :

Post by Javier »

Hello Paul!
In the last line of the code, if we change the method getAsDouble to get, and we run the code returns null.
But why is not throwing NullPointerException?

Code: Select all

Supplier s2 = b2::getPrice; // price is null, so s2 is null.
System.out.println(b2.getTitle()+" "+s2.get());
Thank you

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1814 :

Post by admin »

Well, thats ocajp stuff. First, do System.out.println(s2); and see if s2 is really null!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests