• Post Reply Bookmark Topic Watch Topic
  • New Topic

OCP Study Guide - possible errata Ch7 Q17 (Sybex)  RSS feed

 
matt stallings
Greenhorn
Posts: 4
2
Java Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 7 - Questions 17 (pg 401) has the correct answer listed as B (pg 564) and claims the code compiles.  However, the import is for java.util.concurrent.*; which does not include AtomicInteger class from java.util.concurrent.atomic.  I believe the answer should be D but I could be missing something.  Thanks!
ch7-17.png
[Thumbnail for ch7-17.png]
AtomicInteger
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37462
537
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added the publisher to the thread title to make it obvious which book this is about.

You are correct it would should have had the import there. But it isn't an errata because we got lucky! After this book went to print, Oracle added verbiage to all their exams saying imports may or may not be provided. So a missing import is now implied on the exam.
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 4114
34
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:

You are correct it would should have had the import there. But it isn't an errata because we got lucky! After this book went to print, Oracle added verbiage to all their exams saying imports may or may not be provided. So a missing import is now implied on the exam.

I don't think that is the right interpretation of Oracle's assumption. You can assuming missing imports if there are no import statements. You cannot assume the existence of one missing import when the code listing contains import statements. Here is what they've specified:

If sample code do not include package or import statements, and the question does not explicitly refer to these missing statements, then assume that all sample code is in the same package, or import statements exist to support them.

Assuming the existence of one import statement when other import statements are present is bad advice. Specially when one of the options is "will not compile".

HTH,
Paul.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!