Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Something wrong in the book OCA 8 (Sybex)

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code should compile according to the book OCA page 200:

But it dose not compile !!!
can somebody look at it please and figure out the problem
Posts: 69748
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I shall move you to a different forum, where we usually discuss that sort of question. Please provide fuller details of the book including authors' names and which version of the exam it is for.
Please supply more information; the code you have shown won't compile, but maybe there is other code somewhere with a two‑arguments constructor.
author & internet detective
Posts: 40035
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I edited the subject to reference which book.

Page 199 defines the Hamster class with two constructors:

Page 200 shows what would happen if you made various changes to the first constructor. In the example you mention, it is that you substitute it with

The book doesn't create a standalone class with one Hamster constructor. As you noted, that would  not compile.
this is supposed to be a surprise, but it smells like a tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic