• 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

Sybex Practice Tests 11 error - Chapter 7 (Java Platform Module System) Q 12

 
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
Hello!

Maybe this error does not belong to this book, but I noticed a conflict between algorithm for determining the name of an automatic module (OCP Java 11 Study guide part II) and explanation in Practice tests book for question 12 in Chapter 7.
Algorithm in Study guide says "Replace any remaining characters other than letters and numbers with dots". However, in practice tests book, correct name for automatic module for dog-arthur2.jar is said to be "dog.arthur" instead of "dog.arthur2". Explanation for this is "The rules for determining the name include removing the extension, removing numbers, and changing special characters to periods ( . )".

According to study guide's algorithm it should be dog.arthur2 or am I wrong? "2" shouldn't count as version information here or should it?
 
J Noot
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, according to Oracle docs the correct answer should be dog.arthur2 not dog.arthur as said in explanation.

If starting point is dog-arthur2.jar:

1. ".jar" is removed: dog-arthur2
2. name "dog-arthur2" does not match regular expression "-(\\d+(\\.|$))" for removing version
3. All non-alphanumeric characters ([^A-Za-z0-9]) in the module name are replaced with a dot ("."): dog.arthur2

So the correct answer is dog.arthur2 and numbers are not removed
 
author & internet detective
Posts: 41855
904
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
You are correct! I've added this to the errata.

I dislike the way this works, but that doesn't change the behavior .
 
Would you like to try a free sample? Today we are featuring tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic