b*g 发帖数: 644 | 1 8. Comparison assignment ( = rather than == )
This is an easy error to make. If you're used other languages before,
such as Pascal, you'll realize just how poor a choice this was by the
language's designers. In Pascal, for example, we use the := operator for
assignment, and leave = for comparison. This looks like a throwback
to C/C++, from which Java draws its roots.
Fortunately, even if you don't spot this one by looking at code on the
screen, your compiler will. Most commonly, it will report |
|