Campbell Ritchie wrote:Please avoid coloured text, which many people can't read. I have changed your text to black.
Why is that an error? B&S are using a as a generic variable name.
They are not using "a" as generic variable name. Please read the following question of OCP Java SE 11 Programmer I Study Guide (Sybex Ch-5 - p.213) from Jeanne boyarsky and Scott Selikoff
9. What is the result of the following code? (Choose all that apply.)
A. 2
B. 4
C. 7
D. 10
E. ==
F. equals
G. An exception is thrown.
H. The code does not compile.
They are trying to explain line 22 In the Appendix A - p. 506 but using the wrong variable
a instead of
s2.
The first line in the last paragraph says
For the second part, a += 2 expands to a = a + 2.
It should be
For the second part, s2 += 2 expands to s2 = s2 + 2.