This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Errata - Sybex 829 - Chapter 6

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

I think there is an errata on Chapter 6, page 309 on the TIP box.

This rule applies to primitive types and object types alike.



You can't override a method that returns double with a method that returns int.

for example:
On class A:


On class B that extends class A:


The method on class B will not compile.

Thanks!
João Lopes
 
João Lopes
Greenhorn
Posts: 15
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I found another one on page 316:

An abstract method can only be declared in an abstract class.



Shoudn't it be "An abstract method can only be declared in an abstract class or an interface." ?

Thanks,
João Lopes
 
Saloon Keeper
Posts: 15276
350
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe in place of writing abstract class, they can just write abstract type. Interfaces are implicitly abstract.
 
João Lopes
Greenhorn
Posts: 15
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

João Lopes wrote:I think I found another one on page 316:

An abstract method can only be declared in an abstract class.



Shoudn't it be "An abstract method can only be declared in an abstract class or an interface." ?

Thanks,
João Lopes



Regarding this you have the same reference on the Summary topic but this time includes the interface.

An abstract method can only be placed inside an abstract class or interface.



But on the Exam Essentials topic is missing mentioning interfaces again:

Abstract methods follow all the method override rules and may be defined only within abstract classes



Thanks,
João
 
author & internet detective
Posts: 41775
887
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

João Lopes wrote:Hi,

I think there is an errata on Chapter 6, page 309 on the TIP box.

This rule applies to primitive types and object types alike.



You can't override a method that returns double with a method that returns int.

for example:
On class A:


On class B that extends class A:


The method on class B will not compile.

Thanks!
João Lopes


The book doesn't say it does. Just that you can't mix a primitive and void.
 
Jeanne Boyarsky
author & internet detective
Posts: 41775
887
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

João Lopes wrote:I think I found another one on page 316:

An abstract method can only be declared in an abstract class.



Shoudn't it be "An abstract method can only be declared in an abstract class or an interface." ?

Thanks,
João Lopes


While this is true, the text you quoted is in chapter 6 and interfaces are covered in chapter 7.  So true as of point in time.
 
Jeanne Boyarsky
author & internet detective
Posts: 41775
887
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will make a note about consistency. Odd we included it in the one place.
 
João Lopes
Greenhorn
Posts: 15
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:

João Lopes wrote:Hi,

I think there is an errata on Chapter 6, page 309 on the TIP box.

This rule applies to primitive types and object types alike.



You can't override a method that returns double with a method that returns int.

for example:
On class A:


On class B that extends class A:


The method on class B will not compile.

Thanks!
João Lopes


The book doesn't say it does. Just that you can't mix a primitive and void.




The book on the TIP box says the following:

A simple test for covariance is the following: given an inherited return type A and an overriding return type B, can you assign an instance of B to a reference variable for A without a cast? If so, then they are covariant. This rule applies to primitive types and object types alike. If one of the return types is void, then they both must be void, as nothing is covariant with void except itself.



Isn't it saying that the test for covariance described applies to primitive types and object types? Or I interpreted it wrong?

Regards,
João
 
Jeanne Boyarsky
author & internet detective
Posts: 41775
887
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
We didn't mean primitive and object types together though.
 
But how did the elephant get like that? What did you do? I think all we can do now is read 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