Which one of the following statements will compile without any errors?
now()
;d)
the now()
method defined in LocalDate does not take any arguments and returns a LocalDate object.
hence, the signature of now()
method matches that of the only abstract method in the Supplier interface: T get()
.
hence, the method reference Local::now can be assigned to Supplier<LocalDate> and the statement compiles without any errors.
other options show improper use of method reference and they will result in compiler error(s).