• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bug in K&B book

 
Avishek Banerjee
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the code in Figure 3.5 of SCJP 5 book has a bug. The code says:



This code will not compile. The second parenthesis after the first line should not be present.
 
Atul Sawant
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct.

It should be...

Cats[][] myCats =
{{new Cat("Fluffy"), new Cat("Zeus)},
{new Cat("Bilbo"), new Cat("Legolas"), new Cat("Bert")}};
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You get my vote, simple braces count results in residual brace count of 1 not zero
Mr Bates, sir, put it in the list.
 
Jeronimo Sanchez
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a recent copy of the book and the bug is already fixed.
 
Bert Bates
author
Sheriff
Posts: 8900
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow Avishek!

I'm really worried! I've checked both versions of the book, 1.4 and 5.0, and neither one of them looks like the code you've listed???

Can you double check your copy of the book and get back to me?

Thanks,

Bert
 
Avishek Banerjee
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr. Bates,

My book does have this defect. But, I checked with friends. They don't have it. Might be some problem with my book. Its India, you know. Here copy right means right to copy . So, may be my vendor follows that definition.
 
Bert Bates
author
Sheriff
Posts: 8900
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow!

Well I'm glad that your friends' books don't have that issue!

Good luck with your studies.

Bert
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic