This week's book giveaway is in the Python forum.
We're giving away four copies of High Performance Python for Data Analytics and have Tiago Rodrigues Antao on-line!
See this thread for details.
Win a copy of High Performance Python for Data Analytics this week in the Python 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 ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Assessment Test (Sybex)

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I think I've found 2 more mistakes in the Assessment Tests of the book (OCP Study Guide).

In Q.8 on p. xlii, answer A says "Wolf has-a name" which is true according to the solutions. However, the other answers refer to the class name, not to the name of the field. Also the discussion in Chapter 2 refers always to the class name, never to the field name (as far as I remember). So it would be more correct to say that "Wolf has-a String", isn't it?

In Q.14, I found some more mistakes: The java.util.Scanner class is not properly imported; and also the RainException class is not static - so it cannot be instantiated in the static method in l.7.

Kind regards

Peter
 
Marshal
Posts: 71766
312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please quote a little more of the parts you are worried about. Also please give more details about the book, e.g. author, so those who have the book can look up the pages for themselves. Thank you for providing the page numbers, which is very helpful for anybody who recognises the book (). I don't have a copy myself.

It is customary when discussing association, inheritance, aggregation, and composition to say things like

A taxi IS-A car.
A car HAS-A driver.
A car HAS-A registration number.
A car HAS[-A] wheel[s].
A car HAS[-A] passenger[s].

Now, the driver and the passenger might be instances of the Person class, so you don't usually say A car HAS-A person, and if the registration number is implemented as a String, you would not usually say a car HAS-A String, so I think I would probably agree with the first solution given.

Please show us the code where the Scanner isn't imported properly, and how that Exception is instantiated.
 
Peter Duke
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, I'm sorry, I thought the forum is just about one book :-) It's Boyarsky-Selikoff, OCP Study Guide.

I'm quite fine now with the first one - this was

so we say here that Animal has-a name?

The second one was

So the question was, how many compilation errors are in here.
(1) The line numbers were given to start with one, so the import for java.util.Scanner is missing.
(2) String does not implement AutoCloseable, so cannot be used with try-with-resources statement.
(3) RainException is not catched or declared.
(4) RainException is not static, cannot be instantiated from the static method main.
(5) In the finally block, s is not available anymore (it goes out of scope after the try block).
So these would be 5 errors.
 
author & internet detective
Posts: 40400
821
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter,
You are correct and I've added this to the errata. Two of those errors were accidents .
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic