Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

OCP Java SE 17 - Introduction/Assessment-Test - Question 9

 
Greenhorn
Posts: 5
2
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question 9, in the introduction chapter, shows the following module definition.



Is this a valid, Java 17, model definition?  I am asking this question as the above does not compile and produces the following error.



The options available do not include compilation errors, as shown in the attached file.
Question.png
[Thumbnail for Question.png]
 
Greenhorn
Posts: 14
1
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think is a typo, IIRC `public` keyword is not allowed on module declarations.
 
author & internet detective
Posts: 41086
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Albert,
Welcome to CodeRanch! I've given you a cow for the very first errata report in the book. You are correct that "public" shouldn't be there. I checked chapter 12 (the modules chapter) and the online exams. The error doesn't appear there; just in the intro.

Still wrong but at least not prevalent. Phew!
 
Greenhorn
Posts: 20
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I just started studying the book, and looking for errata on the Introduction.
I actually do not understand why this is considered an error. I mean, in the "Answers to Assessment Test" (page lx) it is stated:


D. If this were a valid module-info.java file, it would need to be placed at the root directory of the module, which is option A. However, a module is not allowed to use the public access modifier. Option D is correct because the provided file does not compile regardless of placement in the project.



So, it seems to me OK. I mean, the correct answer is just "none of the above" since the file would not compile, exactly because of the public access modifier.
Or am I missing something?

Thanks,
Ilenia
 
Jeanne Boyarsky
author & internet detective
Posts: 41086
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ilenia,
Because I was tired? You are correct. It is not an errata. The answer at the end of the intro is D  and even says the public modifier isn't allowed!

I have you a cow and removed it from the errata list. (Which I am thankful is a digital easy to edit form!)
 
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic