Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Sun Oct 06, 2019 11:26 pm
by sir_Anduin@yahoo.de
I dont understand why 1 is incorrect
The module that defines Print service must be present on --module-source-path for book module to compile.
If I require it, it should be on the module-path

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Mon Oct 07, 2019 4:30 am
by admin
It is explained in the explanation:
book module can be compiled in two ways:  Either put the code for the org.pdf module on the --module-source-path  or put compiled classes/jar of the org.pdf module on the --module-path.
That is why option 1 is incorrect. It says "must". But as explained above, to compile the book module, the module containing the print service can be put on the the --module-path as well.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Wed Apr 29, 2020 4:13 am
by wakedeer
What does The module that defines Print service mean?
Is it org.pdf module or a service provider module?

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Wed Apr 29, 2020 5:43 am
by admin
The module that defines the print service is the module that defines the interfaces of that service i.e. org.pdf.
The service, in this case, is defined by org.pdf.Print interface, which is why the module-info has uses org.pdf.Print; clause.

The module that implements the print service could be in any other module but there will be no direct dependency on that module in the book module.

For thorough understanding, you may want to go through this document: http://openjdk.java.net/projects/jigsaw/spec/sotms/

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Tue Aug 25, 2020 9:25 am
by liugengyu
I don't understand why the option "The module that defines Print service must be present on --module-path for book module to execute." is incorrect.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Tue Aug 25, 2020 11:00 am
by admin
Because it is not a must. As explained in the explanation, it can work even if you have the source code of the module that defines print service on --module-source-path.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Mon Dec 07, 2020 1:12 pm
by philippe
Hi Admin, how do you execute a module with the --module-source-path option? The java command does not provide such an option. Hence, I also think that the option "The module that defines Print service must be present on --module-path for book module to execute" is correct.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Mon Dec 07, 2020 1:25 pm
by admin
The problem statement is talking about compilation not execution.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Mon Dec 07, 2020 3:32 pm
by philippe
The problem statement is "Which of the following statements are correct?". The mentioned option states "for book module to execute". Not sure what exactly you are referring to with "The problem statement is talking about compilation".

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Mon Dec 07, 2020 9:57 pm
by admin
You are right. This should be a correct option.
Fixed.
thank you for your feedback!
Paul.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Tue Jan 05, 2021 6:49 pm
by philippe
Please also update the 1z0-816 question bank.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Tue Jan 05, 2021 9:36 pm
by admin
Done.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Fri Jan 08, 2021 12:38 am
by teodorj
Please update also for 817. Thanks :)

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Fri Jan 08, 2021 3:41 am
by admin
Done.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Sat Feb 20, 2021 8:29 am
by noeloo
At least one module that provides Print service must be present on --module-path for book module to execute.
Why is that not necessarily true? Because there must be exactly one, not more?

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Sat Feb 20, 2021 9:36 pm
by admin
A service implementation is not actually required for execution of a module because services are loaded only when required.

For example, if the service user module has this code:

Code: Select all

java.util.ServiceLoader<BloggerService> bsLoader = java.util.ServiceLoader.load(BloggerService.class);///
for (BloggerService bs : bsLoader){
     bs.blog("Hello from textbook");
}

//or

Optional<BloggerService> bs1 = bsLoader.findFirst();
bs1.ifPresent(bs->bs.method());
There will be no error while execution.

But if a module says it uses a particular service, then it would be fair to assume that it would actually try to access that service. If there is no module in the module path that provides the service, then it really depends on how the application is coded. So, I agree that this option seems too vague.

-Paul.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Sat Mar 20, 2021 6:54 am
by kabanvau
You say:

The module that defines the print service is the module that defines the interfaces of that service i.e. org.pdf.

And this option was marked as correct:

A module that defines Print service may be added later without requiring book module to recompile.

How can you add an interface definition later without requiring book module to recompile? You can do it with a service provider only, which implements that interface, isn't it?

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Sat Mar 20, 2021 10:56 am
by admin
Yes, as noted in the explanations, the wording is ambiguous.
Logically, the module that defines the service (i.e. the module that contains the interface) must be available at compile time. One or more modules that implement the service need to be present only during the execution.

You need to select the best options. Depending on the number of options that you have to select, you might have trouble selecting an option due to unclear wording.
This question is just meant to make you aware of this issue with module related questions.

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Mon Apr 19, 2021 8:05 am
by pavel.gurinovich
A module that defines Print service may be added later without requiring book module to recompile.
May be in this answer word implements was mistakenly replaced by defines?

Re: About Question enthuware.ocpjp.ii.v11.2.3447 :

Posted: Mon Apr 19, 2021 8:57 pm
by admin
Yes, that is possible. But we are not sure. Just be aware of the issue and answer such question carefully during the real exam.