What do you think?
Rate this book
912 pages, Paperback
First published January 1, 2005
Error 1, in Book 2 Chapter 3, section: Using Increment and Decrement Operators, page 129
int a = 5;
int b = a--; // both a and b are set to 4
When the second statement is executed, the expression a--is evaluated first, so a
is set to 4. Then the new value of a is assigned to b. Thus both a and b are set to 4.
should be a--
Error 2, in Book 2 Chapter 3, section: Using Increment and Decrement Operators, page 130
int a = 5;
int b = --a; // b is set to 5, a is set to 4.
This example is similar to an earlier example, but this time the prefix increment
operator is used. When the second statement is executed, the value of a is assigned
to b. Then a is decremented. As a result, b is set to 5, and a is set to 4.
should be a-- postfix decrement
Error 3, in Book 2 Chapter 3, section: Division by zero, page 149
» If you divide a number by zero, and the sign of both numbers is the same, the
result is positive infinity. 0.0 divided by 0.0 is positive infinity, as is -34.0 divided by -0.0.
should be 40.0
» If you divide a number by zero, and the signs of the numbers are different, the
result is negative infinity. -40.0 divided by 0.0 is negative infinity, as is 34.0 divided by 0.0.
should be -0.0