• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

K&B 7 ch1 Self Test Q9

 
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
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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.
 
Grow a forest with seedballs and this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic