• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

K&B 7 ch1 Self Test Q9

 
Douglas Cyporyn
Greenhorn
Posts: 21
4
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings,

I've just started studying from "OCA/OCP Java SE 7 Programmer I & II Study Guide (Exams 1Z0-803 & 1Z0-804)", by Kathy Sierra and Bert Bates. The book looks fantastic and is very thorough. However, I am really stuck on one simple question. I'm hoping someone here can help so that I can let it go.

Question number 9 on the Chapter 1 Self Test:

9. Given



What is the result?
A. 13
B. Compilation fails due to multiple errors
C. Compilation fails due to an error on line 6
D. Compilation fails due to an error on line 7
E. Compilation fails due to an error on line 11

The answer I chose is B.

The correct answer stated is D due the countGold() method being invoked from static context. I get that. But why not the curly brace too?

Thanks!
Doug
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably because the missing curly brace in the class declaration was not intended to be missing. So I guess you found the 1st erratum in this study guide

I was one of the technical reviewers of this book, so I have a little extra benefit which might help you I can check the manuscript I got for reviewing and see if the curly brace was present or not. I just had a look and my assumption is confirmed. Line 4 looks like: 4. public class Frodo extends Hobbit { So you definitely have noticed (and reported) the 1st erratum.

So if you answered B just because of the countGold() method and the missing curly brace in the class declaration, you may award yourself 1 point for this question
 
Douglas Cyporyn
Greenhorn
Posts: 21
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, that's really great news and really great feedback! It seems obvious now that it was a misprint but I wasn't sure.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic