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());