• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

[1Z0-815] Sybex 815 p526 - module-info.java location

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

On page 485, question asks:


Which statement is true of the following code?
zoo.staff
|-- zoo
  |-- staff
     |-- Vet.java

...
D. The directory structure would be a valid module if module-info.java were added directly underneath zoo.staff
E. The directory structure would be a valid module if module-info.java were added directly underneath zoo



On page 526 the answer is:


D. Modules are required to have a module-info.java file at the root directory of the module. Option D matches this requirement.



It seems to me that option E matches this requirement.
Indeed the root directory of the module is zoo.staff.
I successfuly compiled and run this module with the following files:

zoo.staff\module-info.java


zoo.staff\zoo\staff\Vet.java


Do you agree with me? or did I miss something?
 
Bartender
Posts: 3904
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, could you clarify why may consider option E correct?
The book says option D correct, you also seem tested option D and it works.

Maybe there is some confusion caused by directories names, and/or module/package names?
Try then something like


modRoot
  |  
  | - module-info.java
  |
  zoo--
         |
         staff--
                 |
                Vet.java


and




Once JVM sees "exports zoo.staff" it will start searching that package starting the directory where module definition is located, and if you put module-info.class inside the "zoo" directory, JVM modules resolver will not be able to find the first part of the package -- "zoo" directory. Exporting of non-existing packages is not allowed.

HTH,
MZ

 
Adrien Vergnaud
Greenhorn
Posts: 5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply

I did not correctly understand the word "underneath". If "underneath" means "inside" then I was wrong. My bad.
 
We find this kind of rampant individuality very disturbing. But not this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic