• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

[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: 3731
39
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic