If I require it, it should be on the module-pathThe module that defines Print service must be present on --module-source-path for book module to compile.
About Question enthuware.ocpjp.ii.v11.2.3447 :
Moderator: admin
-
- Posts: 62
- Joined: Fri Aug 07, 2015 2:16 pm
- Contact:
About Question enthuware.ocpjp.ii.v11.2.3447 :
I dont understand why 1 is incorrect
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
It is explained in the explanation:
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.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.
If you like our products and services, please help us by posting your review here.
-
- Posts: 3
- Joined: Tue Apr 21, 2020 7:04 am
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
What does The module that defines Print service mean?
Is it org.pdf module or a service provider module?
Is it org.pdf module or a service provider module?
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
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/
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/
If you like our products and services, please help us by posting your review here.
-
- Posts: 8
- Joined: Thu Jul 09, 2020 4:09 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
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.
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
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.
If you like our products and services, please help us by posting your review here.
-
- Posts: 29
- Joined: Sun Jul 16, 2017 4:24 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
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.
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
The problem statement is talking about compilation not execution.
If you like our products and services, please help us by posting your review here.
-
- Posts: 29
- Joined: Sun Jul 16, 2017 4:24 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
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".
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
You are right. This should be a correct option.
Fixed.
thank you for your feedback!
Paul.
Fixed.
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 29
- Joined: Sun Jul 16, 2017 4:24 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
Please also update the 1z0-816 question bank.
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
Done.
If you like our products and services, please help us by posting your review here.
-
- Posts: 33
- Joined: Tue Jun 19, 2018 10:27 am
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
Please update also for 817. Thanks
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
Done.
If you like our products and services, please help us by posting your review here.
-
- Posts: 61
- Joined: Sat Feb 15, 2020 8:56 am
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
Why is that not necessarily true? Because there must be exactly one, not more?At least one module that provides Print service must be present on --module-path for book module to execute.
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
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:
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.
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());
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.
If you like our products and services, please help us by posting your review here.
-
- Posts: 14
- Joined: Thu Nov 21, 2019 5:48 am
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
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?
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?
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
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.
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.
If you like our products and services, please help us by posting your review here.
-
- Posts: 13
- Joined: Mon Nov 18, 2019 4:59 am
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
May be in this answer word implements was mistakenly replaced by defines?A module that defines Print service may be added later without requiring book module to recompile.
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3447 :
Yes, that is possible. But we are not sure. Just be aware of the issue and answer such question carefully during the real exam.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 44 guests