Page 1 of 1

About Question enthuware.ocpjp.v8.2.1814 :

Posted: Thu Oct 22, 2020 7:59 am
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

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

Posted: Thu Oct 22, 2020 8:52 am
by admin
Well, thats ocajp stuff. First, do System.out.println(s2); and see if s2 is really null!