About Question enthuware.ocpjp.v8.2.1814 :
Posted: Thu Oct 22, 2020 7:59 am
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?
Thank you
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());