• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Ranch Hand
Posts: 652
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rohan,

it's a genuine errata, since the english version contains the mistake too.
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Heus, bubulci! (*)

One erratum, singular.
Several errata, plural.


Yours,
Bu.

(*) = howdy, cowboys!
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic