About Question enthuware.ocpjp.v21.2.3144 :

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

Moderator: admin

Post Reply
n199a_
Posts: 8
Joined: Wed Jan 08, 2025 9:43 am
Contact:

About Question enthuware.ocpjp.v21.2.3144 :

Post by n199a_ »

Question:

Consider the following code appearing in a module-info.java:

Code: Select all

java
module com.amazing.movies {
    requires transitive com.amazing.customer;
}
Identify the correct statements.

Options:

1. Any module that requires the com.amazing.movies module must also require the com.amazing.customer module.
2. Any module that requires the com.amazing.movies module can use the com.amazing.customer module without requiring it.
3. Only a module that requires the com.amazing.movies module can use the com.amazing.customer module.
4. Any module that requires the com.amazing.customer module must also require the com.amazing.movies module.
5. Any module that requires the com.amazing.movies module must require the com.amazing.customer module instead of com.amazing.movies.

---

Problem:

Options 2 and 3 effectively mean the same thing:

- Option 2 states that any module requiring `com.amazing.movies` can access `com.amazing.customer` without explicitly requiring it.
- Option 3 says that only modules requiring `com.amazing.movies` can access `com.amazing.customer`. That’s logically correct too — since transitive only works through the module that declares it.

So both statements are logically true, but the test allows you to pick only one.
That creates confusion because it seems like there are two valid answers — and there’s no clear reason why only one is accepted.

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

Re: About Question enthuware.ocpjp.v21.2.3144 :

Post by admin »

Option 3 is different from option 2 because option 3 means that a module that doesn't require the com.amazing.movies module cannot use classes from the com.amazing.customer module, but that is not true because such a module can have "requires com.amazing.cusomter" clause and then use the classes from the com.amazing.customer module. It is not necessary for such a module to have a "requires com.amazing.movies" module.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests