Consider the following code appearing in a module-info.java:
Code: Select all
java
module com.amazing.movies {
requires transitive com.amazing.customer;
}
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.