Page 1 of 1

About Question enthuware.ocpjp.i.v11.2.3018 :

Posted: Mon Jul 22, 2019 11:18 am
by javabean68
Hi all,

why is the option
An application can either use module-path or classpath but not both.
wrong?

Thank you in advance
Regards
Fabio

Re: About Question enthuware.ocpjp.i.v11.2.3018 :

Posted: Mon Jul 22, 2019 9:48 pm
by admin
It is wrong because you can use both the switches.

Re: About Question enthuware.ocpjp.i.v11.2.3018 :

Posted: Sun Aug 18, 2019 6:50 pm
by hamzaBlm
Hi admin,

This option states:
A module can be used by non-modular code by putting that module on the classpath.
Shouldn't it be "A module can be used by non-modular code by putting classes of that module on the classpath."

something like: java Main -classpath mymod/my.pack1.*;mymod/my.pack2

Please, help, I am confused I've already read about classpaths and modules. I can't understand why this option is correct!?

Re: About Question enthuware.ocpjp.i.v11.2.3018 :

Posted: Sun Aug 18, 2019 10:13 pm
by admin
Yes, that is what it means. You can also put the module jar on the classpath, instead of individual classes.

Re: About Question enthuware.ocpjp.i.v11.2.3018 :

Posted: Thu Sep 29, 2022 2:41 am
by sohamdatey22
Hi, my understanding is,
The exports just exports, but not opens.(it is accessible but not reflectively.)
opens just opens, not exports.(it is only accessible reflectively.)

is this correct.

Re: About Question enthuware.ocpjp.i.v11.2.3018 :

Posted: Thu Sep 29, 2022 8:47 am
by admin
Right. exports allows compile time dependency while opens allows runtime dependency through reflection.