Page 1 of 1

About Question enthuware.ocpjp.v11.2.3081 :

Posted: Wed Dec 09, 2020 1:31 pm
by Antonicaalex
What s the difference between

Code: Select all

DoubleStream.generate(Random::nextDouble).limit(10).forEach(System.out::print);
[size=85]nextDouble() is an instance method of Random. So, Random::nextDouble is incorrect here.[/size]
And the

Code: Select all

 slist.forEach(Student::debug);
The debug method is instance method as well

Re: About Question enthuware.ocpjp.v11.2.3081 :

Posted: Wed Dec 09, 2020 8:09 pm
by admin
There is no instance of Random available in the context on which nextDouble can be invoked.

But inside foreach, there is an instance of Student available on which debug can be invoked.