Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt about constructors (Java OCA 8 Programmer I Study Guide, Sybex)

 
shivika sharma
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

In reference to the OCA JAVA SE8 Programmer I Guide by Jeanne Boyarsky & Scott Selikoff

In Chapter 5 (Class Design),  Question 2 of Review Questions:




When I execute this code, the output is:  Mammal
where as in the answer explanation it says  Compilation Error (option E).

So is the answer in the book is wrong? Is so what about the answer explanation ?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ss Sharma wrote:So is the answer in the book is wrong? Is so what about the answer explanation ?

It is very important to have a great eye for detail when you try to run the code snippets yourself. I think (actually I am 100% sure) the code snippet you are using is different from the one in the study guide. That's why you can compile the code snippet, but the book claims a compiler error wil be given. So you should revise your code snippet very carefully with the one listed in the book, make the necessary changes and try to compile the code snippet again.
In this topic you'll find an explanation about the same code snippet. Definitely worth reading as well!

Hope it helps!
Kind regards,
Roel
 
shivika sharma
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I found my error.
Thanks for correcting!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic