• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I found my error.
Thanks for correcting!
 
And then the entire population worshiped me like unto a god. Well, me and this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic