About Question enthuware.ocpjp.v11.2.3427 :

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

Moderator: admin

Post Reply
61d14837
Posts: 13
Joined: Tue Jul 21, 2020 1:39 pm
Contact:

About Question enthuware.ocpjp.v11.2.3427 :

Post by 61d14837 »

Please confirm if I understand this concept correctly. In the real world, I would employ the top-down migration strategy because I don't have access to mysql-connector-java.jar The datalayer.jar may belong to the same company but another team could own that project.

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

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

Post by admin »

That is correct.

gayanw
Posts: 4
Joined: Sun Jan 23, 2022 9:03 am
Contact:

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

Post by gayanw »

What if I modularize only the myapp.jar and leave data-layer and mysql-connector-java on the classpath. Will it work?

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

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

Post by admin »

No, classes in explicitly named modules cannot access classes from jars on classpath. Only automatic modules (which are implicitly named modules) can do that. So, you need to use automatic modules. Please go through a good book to understand this concept. We recommend the modules chapter of Hanumant Deshmukh OCP Java 17/21 Fundamentals study guide.

gayanw
Posts: 4
Joined: Sun Jan 23, 2022 9:03 am
Contact:

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

Post by gayanw »

Thanks for the info.

aPerson
Posts: 17
Joined: Fri Aug 12, 2022 10:19 am
Contact:

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

Post by aPerson »

Does the question mean: how can you make myapp modularized with as few steps as possible, starting at the bottom? Would leaving mysql as it is, making datalayer automatic and myapp modularized be a good answer to that? Or is the premise of the question that mysql and datalayer should be modularized (either automatic or regular)?

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

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

Post by admin »

The problem statement says that you have to use the bottom-up approach to modularize your app. If you use automatic modules then you are not using bottom-up approach (you are using top-down approach). The concept of automatic modules is created solely for the top-down approach.

usermanguy
Posts: 2
Joined: Sat Sep 21, 2024 1:42 pm
Contact:

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

Post by usermanguy »

@admin
Scott and Jeanne's book directly states, and I quote: "Unnamed modules do not export any packages to named or automatic modules" and in table 17.3 write "An unnamed module is readable by other modules on the module path?: NO"

This is in direct conflict with what you state about the alternative to this question, using a top-down migration where you for some reason leave the mysql package on the classpath.

According to the book's definition of a top-down migration, the first step is to migrate *all* modules to the module path, making them automatic modules, and then one at a time giving them module-info files. How come you suggest leaving one on the classpath? Are Scott and Jeanne just dead wrong on the entire Modules chapter?

I will also say that most resources I can find on the internet clearly specify that any module on the module path *cannot* see modules on the classpath.

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

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

Post by admin »

That book is wrong. Not only the part that you have quoted is incorrect several other points in that book are incorrect. Please check with the authors of that book or check their errata page.

Our explanation is correct. You may confirm from the source: https://openjdk.org/jeps/261

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

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

Post by admin »

>I will also say that most resources I can find on the internet clearly specify that any module on the module path *cannot* see modules on the classpath.

If you read that, then you are reading unreliable material. Because this rule does not apply to automatic modules. They can read everything including classes in the unnamed module. That is the whole point of having automatic modules.

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

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

Post by admin »

Suggest you to go through the modules chapter of Hanumant Deshmukh OCP Java 17/21 Fundamentals study guide. Costs only $2.99 but explains these (and several other) points correctly.

anthonysk0210
Posts: 3
Joined: Tue Oct 01, 2024 12:59 pm
Contact:

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

Post by anthonysk0210 »

why option 3 "The mysql jar must first be converted into modular jar. The datalayer.jar need not be converted." is not the correct answer?

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

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

Post by admin »

You do not own mysql.jar . How will you make it modular? It is a third party jar.
Please go through the responses above.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 14 guests