• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt about question 14 chapter 5 (Java OCA 8 Programmer I Study Guide, Sybex)

 
Ben Pittens
Greenhorn
Posts: 29
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a question about the Boyarsky and Selikoff book.

In the review questions of chapter 5 at question 14 there is answer B:


"B. A class that implements HasVocalCords must override the makeSound() method.


According to the answers this anwer isn't correct.

Should it be correct if it was in stead of "override" "implement".

So you get this:


"B. A class that implements HasVocalCords must implement the makeSound() method.


Would that be correct?

Thanks in advance
Kindregards
Ben
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben Pittens wrote:Would that be correct?

No! That makes no difference. You still could have an abstract class which is not required to implement/override the makeSound() method. Illustrated in this code snippetThe abstract Bird class doesn't override (implement) the makeSound() method and the code still compiles successfully. That's why option B is incorrect, because it's not required to override (implement) this method. If option B would have been "A concrete class that implements HasVocalCords must override (implement) the makeSound() method.", it would have been a correct answer.

Hope it helps!
Kind regards,
Roel
 
Ben Pittens
Greenhorn
Posts: 29
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roel,

Thanks, yes off course , there is not mentioned anything in answer B about the type of the class abstract or concrete class. So it also can be an abstract class.
That is a tricky one.

Thanks for you Answer.
Kind regards Ben
 
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
Ben Pittens wrote:there is not mentioned anything in answer B about the type of the class abstract or concrete class. So it also can be an abstract class.

And you should never assume anything which is not clearly mentioned in the question (and/or different options). Meaning for option B you should not interpret "a class" as "a concrete class" or "an abstract class". If the question (and/or option) is about concrete classes, it will explicitly state "a concrete class" (or "a nonabstract class"). And sometimes the "context of a question" is also important when answering a question. In this topic you'll find a nice explanation with some examples about this "context of a question".

Ben Pittens wrote:That is a tricky one.

Expect the actual exam to have some tricky questions as well
 
Scott Selikoff
author
Saloon Keeper
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben Pittens wrote:That is a tricky one


We try!

Seriously though, the exam does have similar questions as tricky, so I don't think we were too far off here. The key, as Roel pointed out, is to understand that a class could be abstract or concrete, unless it is otherwise marked,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic