Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error on K&B book (Java 6) page 579

 
Bhaarat Sharma
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe there is an error on page 579 in the toArray() section


Now let's take a look at the toArray() method. There's nothing too fancy going
on with the toArray() method; it comes in two flavors: one that returns a new
Object array, and one that uses the array you send it as the destination array:


the line


will throw an Incompatible types error because required is Integer[] and found is Object[]

Have other people noticed this as well or am I doing something wrong?
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, it complies and runs. It seems to be a fine widening conversion of iL.

Regards,
Dan
 
Bhaarat Sharma
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My fault.

I see my mistake. I guess its time to hit the bed for me.

Thanks
-bhaarat
 
shivdhwaj pandey
Ranch Hand
Posts: 67
Java PHP Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
go and take proper sleep dude
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic