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

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

Moderator: admin

Post Reply
javabean68
Posts: 31
Joined: Wed Mar 16, 2016 8:38 am
Contact:

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

Post 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

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

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

Post by admin »

It is wrong because you can use both the switches.

hamzaBlm
Posts: 18
Joined: Thu May 23, 2019 11:58 am
Contact:

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

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

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

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

Post by admin »

Yes, that is what it means. You can also put the module jar on the classpath, instead of individual classes.

sohamdatey22
Posts: 28
Joined: Sun Sep 11, 2022 3:55 am
Contact:

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

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

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

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

Post by admin »

Right. exports allows compile time dependency while opens allows runtime dependency through reflection.

Post Reply

Who is online

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