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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
sir_Anduin@yahoo.de
Posts: 62
Joined: Fri Aug 07, 2015 2:16 pm
Contact:

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

Post 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

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

wakedeer
Posts: 3
Joined: Tue Apr 21, 2020 7:04 am
Contact:

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

Post by wakedeer »

What does The module that defines Print service mean?
Is it org.pdf module or a service provider module?

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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/
If you like our products and services, please help us by posting your review here.

liugengyu
Posts: 8
Joined: Thu Jul 09, 2020 4:09 pm
Contact:

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

Post 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.

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

philippe
Posts: 29
Joined: Sun Jul 16, 2017 4:24 pm
Contact:

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

Post 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.

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

The problem statement is talking about compilation not execution.
If you like our products and services, please help us by posting your review here.

philippe
Posts: 29
Joined: Sun Jul 16, 2017 4:24 pm
Contact:

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

Post 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".

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

You are right. This should be a correct option.
Fixed.
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.

philippe
Posts: 29
Joined: Sun Jul 16, 2017 4:24 pm
Contact:

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

Post by philippe »

Please also update the 1z0-816 question bank.

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Done.
If you like our products and services, please help us by posting your review here.

teodorj
Posts: 33
Joined: Tue Jun 19, 2018 10:27 am
Contact:

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

Post by teodorj »

Please update also for 817. Thanks :)

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Done.
If you like our products and services, please help us by posting your review here.

noeloo
Posts: 61
Joined: Sat Feb 15, 2020 8:56 am
Contact:

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

Post 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?

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

kabanvau
Posts: 14
Joined: Thu Nov 21, 2019 5:48 am
Contact:

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

Post 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?

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

pavel.gurinovich
Posts: 13
Joined: Mon Nov 18, 2019 4:59 am
Contact:

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

Post 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?

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 69 guests