• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in K&B SCJP 5: topic Assignments Pg. 182, 183

 
Rohan Dhruva
Ranch Hand
Posts: 183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In pg. 182 of the book, on the last code snippet on the page, two bytes "b" and "c" are added into "d". However, on referring to the same code snippet in pg. 183, the code is displayed as if two bytes "a" and "b" are added into "c".

I am using the Indian reprint by "Dreamtech Press" which mentions "Edition: 2007" on the 4th page. Is this error introduced in my edition of the book, or is a genuine errata ?
 
Nik Arora
Ranch Hand
Posts: 652
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can you post the question because what you are asking is not clear. Can you elaborate?.



Regards
Nik
Scjp 1.5
 
Rohan Dhruva
Ranch Hand
Posts: 183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, Nik, I'll try to elaborate. On page 182, in the bottom most code snippet:

byte b = 3;
byte c = 8;
byte d = b + c;
Now, that last statement is wrong and gives a compile error. On page 183, in the compile error, the error is shown as

"Loss of precision.. byte c = a + b;" which I think is a mistake, because we are adding d = b + c;
Similarly, just below that code, the correct code is shown, which again refers to a, b, c:

byte c = (byte) (a+b); which I think should be
byte d = (byte) (b+c);

I hope that's clear ? Basically, it's just a mistake in the name of the variables from one page to the other.
 
Manfred Klug
Ranch Hand
Posts: 377
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rohan,

it's a genuine errata, since the english version contains the mistake too.
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heus, bubulci! (*)

One erratum, singular.
Several errata, plural.


Yours,
Bu.

(*) = howdy, cowboys!
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic