Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!
  • 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
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Sybex Appendix A page 564 - Error in answer to question 17

 
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A correct answer for question 17 should be D. The import for is missing...

Am I missing something?
 
Bartender
Posts: 3705
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have the book, but I assume your concern is missing imports?
On the exam imports are usually implied and should not be considered as compilation errors.
 
Angel Daniel Alonso Tovar
Greenhorn
Posts: 4
MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mikalai Zaikin wrote:I don't have the book, but I assume your concern is missing imports?
On the exam imports are usually implied and should not be considered as compilation errors.



I can share a screenshot of the Oreilly material, if that's allowed... is it allowed?
 
Marshal
Posts: 26519
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, that's "fair use" of copyrighted material in this case.
 
Angel Daniel Alonso Tovar
Greenhorn
Posts: 4
MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Yes, that's "fair use" of copyrighted material in this case.



Please see attached...

meow.png
[Thumbnail for meow.png]
 
Ranch Foreman
Posts: 343
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I share your concern.

The full name of AtomicInteger in Java is:
java.util.concurrent.atomic.AtomicInteger

Your screenshot clearly shows a single import line of:
import java.util.concurrent.*;

Which in Java means to import each and every class in the package java.util.concurrent (but not in any sub-packages if any exist).

AtomicInteger is a class, and it lives in package java.util.concurrent.atomic, a "sub-package" of java.util.concurrent

As imports do not include sub-packages, no reference can be made to AtomicInteger without (1) an import of:

(2) an Import of:


(3) or fully qualifying references to it as:

which is rather a mouthful.

The book is published by Sybex, not O'Reilly, but I don't disagree about anything else.
 
Jesse Silverman
Ranch Foreman
Posts: 343
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In general, when they show you a simple code fragment, you are often expected to presume the appropriate import statements are present but omitted from the fragment.

A nice clue they often provide is that line numbers begin with say, 3 or 5 or 6 or 8 or something...

If they show for instance, a package declaration, or any imports, that question is presumably showing you "all the code" and it is reasonable to presume you are supposed to notice the missing import.

In this case, going as far as showing you one import statement, I believe this is intended to represent a full class definition with all provided imports, in the default (unnamed) package, making your complaint correct.
 
Angel Daniel Alonso Tovar
Greenhorn
Posts: 4
MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correct... That's why my concern with the answers...

I mentioned O'reilly because I'm studying the book in that platform.

Please let me know what else should I do to get that added to the errata.

Thank you,
Andelous.
 
Jesse Silverman
Ranch Foreman
Posts: 343
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Likely when either of the authors gets up enough time, they will pop in here and "batch process" threads here relating to their books.

Sometimes we go off on tangents or give confusing advice, however, normally I think the regular folk around here do a pretty good job of welcoming errata posters, and confirming or denying their suspicions / agreeing or disagreeing whether we think something should count as an actual error.

So you probably don't need to do anything further but hurry up and wait.  In the meantime, according to the clues I gave I would definitely consider that an error.  They show at least one import, and a common mistake beginners make is to think importing a package imports its sub-packages.  It does not, or there is no such thing as sub-packages, depending on who you talk to.
reply
    Bookmark Topic Watch Topic
  • New Topic